Welcome, Guest. Please login or register.

Author Topic: "strange" text captured...  (Read 3336 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline dcr8520Topic starter

  • Full Member
  • ***
  • Join Date: Mar 2002
  • Posts: 107
    • Show all replies
    • http://Amiga.SourceForge.net
"strange" text captured...
« on: February 06, 2003, 04:27:28 AM »
Hello all,

doing some test with the bsdsocket.library, I get (with tcpdump) the following text:

---
BLIZZARDRAM RAM AUTOCONFIG Blizzard 1260 Autoconfig Stuff
Version 1.00 9-Jul-95
(c) phase 5 digital products 1992-95
WELCOME TO THE MACHINE
---

it is supposed that goes out from my blizzard, but, ¿why it pass through a inet connection????
yes, I am a bit paranoic... but the welcome message is suspicious to me....
I dont remember to see before a msg like this, someone knows its nature?


regards
 

Offline dcr8520Topic starter

  • Full Member
  • ***
  • Join Date: Mar 2002
  • Posts: 107
    • Show all replies
    • http://Amiga.SourceForge.net
Re: "strange" text captured...
« Reply #1 on: February 07, 2003, 03:45:50 AM »
:-P :-P :-P
 

Offline dcr8520Topic starter

  • Full Member
  • ***
  • Join Date: Mar 2002
  • Posts: 107
    • Show all replies
    • http://Amiga.SourceForge.net
Re: "strange" text captured...
« Reply #2 on: February 08, 2003, 05:25:22 PM »
joder Zurt k cosas pides.. :-D

well, step by step... mmm...

I get the file httpget.c from the AmiTCP 4.3 SDK, and was edited a bit:

try compiling this:

+++++++++++++++++++C+U+T+++H+E+R+E++++++++++++++++++++++++++++++++++

#include
#include
#include
#include

struct ExecBase * SysBase;
struct DosLibrary * DOSBase;
struct Library * SocketBase, *TimerBase;

#include
#include
#include
#include
#include

int init() {
  if ((DOSBase = (struct DosLibrary *)OpenLibrary("dos.library", 37)) == NULL) return FALSE;
  if ((SocketBase = OpenLibrary("bsdsocket.library", 4)) == NULL) return FALSE;
return TRUE;
}

void clibs() {
    CloseLibrary(SocketBase);
    CloseLibrary((struct Library *)DOSBase);
}

void err(const char *msg) {
fprintf(Output(), msg);
exit(20);
}

static int do_connect(char * name, int port);
static void netperror(char * banner);

//int httpget(char * url)
int main()
{
  char buf[1024], *url;
  char * p, * u;
  int i, port = 80, sd;

  *p = '\0';

 if(!(init())) err("Can't open LIB!");

  if ((sd = do_connect("www.amiga.com", port)) < 0) err("err conectando!");

  *p = '/';

  if ((send(sd, "GET ", 4, 0) != 4) || (send(sd, u, i, 0) != i)) {
    netperror("send");
    return 20;
  }

  while ((i = recv(sd, buf, sizeof buf, 0)) > 0)
    Write(Output(), buf, i);

  if (i != 0) {
    netperror("recv");
    return 20;
  }
 
  return 0;
}

int
getSockAddr(const char *  host,
     int    port,
     struct sockaddr_in * addr)
{
  struct hostent * remote;

  if ((remote = gethostbyname(host)) != NULL)
    memcpy(&addr->sin_addr, remote->h_addr, sizeof addr->sin_addr);
  else if ((addr->sin_addr.s_addr = inet_addr(host)) == (unsigned long)-1) {
    return FALSE;
  }

  addr->sin_port = htons(port);
  addr->sin_family = AF_INET;

  return TRUE;
}

const int ONE = 1;

int inetconn (const struct sockaddr_in * addr)
{
  int sd;

  if ((sd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
    netperror ("socket");
    return -1;
  }
 
  setsockopt(sd, SOL_SOCKET, SO_KEEPALIVE, &ONE, sizeof ONE);
   
  if (connect(sd, (struct sockaddr *)addr, sizeof (struct sockaddr_in)) < 0) {
    CloseSocket(sd);
    netperror("connect");
    return -1;
  }

  return sd;
}


static int do_connect(char * host, int port)
{
  struct sockaddr_in
    addr = { 0 }; /* implicit bzero() here when compiled w/ gcc */
 
  if (getSockAddr(host, port, &addr) == FALSE) {
    Printf("Cannot resolve host address\n");
    return -1;
  }

  return inetconn(&addr);
}

static void netperror(char * banner)
{
  ULONG taglist[5];
 
  taglist[0] = SBTM_GETVAL(SBTC_ERRNO);
  /* taglist[1] set when tag 0 executed */
  taglist[2] = SBTM_GETREF(SBTC_ERRNOSTRPTR);
  taglist[3] = (LONG)&taglist[1]; /* reads and writes tag[1] */
  taglist[4] = NULL; /* TAG_END if is included */

  SocketBaseTagList((struct TagItem *)taglist);

  if (banner)
    Printf("%s:", banner);

  Printf("%s\n", (char *)taglist[1]);
}
+++++++++++++++++++C+U+T+++H+E+R+E++++++++++++++++++++++++++++++++++


I dont know exactly how it was happened.. seems the connection was closed and I even receive data from somewhere (?)
the first time I do it I was received a send() error (or may recv()? I dont remember now),
When I try it now I receive a broken pipe (it happens some secs after the connection was closed and getting data at 17Kb/s with my dialup!!=)

Sorry, I cant be more precise, I will do some test and tell us if something more strange succes... ;-)

hey zurt esto se parece a lo del type no? :-P (a good race condition!)...


regards.

pd.: Karlos: I already do it before the post, without luck