home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HaCKeRz KrOnIcKLeZ 3
/
HaCKeRz_KrOnIcKLeZ.iso
/
ircscripts
/
warirc
/
feprobe.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-04-23
|
2KB
|
78 lines
#include "tcpip.h"
void ssyn(int sendsock, u_long srcaddr, u_long dstaddr, u_short srcport,
u_short dstport, u_long seq)
{
char *pack, *tpack;
int sent;
struct sockaddr_in stuffz;
tpack = create_tcp(htons(srcport),
htons(dstport), htonl(seq), 0, TH_SYN, NULL, 0);
pack = create_ip (srcaddr, dstaddr, IPPROTO_TCP, 75, 1,
tpack, 20);
stuffz.sin_family = AF_INET;
stuffz.sin_port = htons(dstport);
stuffz.sin_addr.s_addr = dstaddr;
sent = sendto(sendsock, pack, 40, 0, (struct sockaddr *)&stuffz,
sizeof(stuffz));
if (sent != 40) { perror("sending SYN"); exit(-1); }
}
int getpack(int listsock, u_long srcaddr, u_long dstaddr, u_short srcport,
u_short dstport, u_long seq)
{
return 1;
}
main (int c, char *v[])
{
int ssock, lsock;
struct hostent *hent;
struct servent *srvent;
u_long us, them, fuckk;
u_short sport, eport;
u_short skrap;
u_char flags;
struct tcphdr *tcphead;
/* char pass[8]; */
if (c!=5) { printf("usage: %s <host> <start port> <end port> <from host>\n", v[0]);
exit(-1); }
/* strncpy(pass, getpass("Password: "), 8);
* if (!strncmp(pass, "r@1$xz%#", 8)) { printf("right!\n"); } else {
* printf("wrong - bye bye\n"); exit(0); }
*/
hent = gethostbyname(v[4]);
if (hent == NULL) {
printf("couldn't get \"from\" hostname!@#\n");
exit(-1);
}
bcopy(hent->h_addr, (char *)&us, hent->h_length);
hent = gethostbyname(v[1]);
if (hent!=NULL)
bcopy(hent->h_addr, (char *)&them, hent->h_length);
else {
printf("could not resolve: %s\n", v[1]);
exit(-1);
}
sport = atoi(v[2]);
if (sport==0) {
printf("can't use %s as a starting port..\n", v[2]);
exit(-1);
}
eport = atoi(v[3]);
if (eport==0) {
printf("can't use %s as an ending port..\n", v[3]);
exit(-1);
}
ssock = socket(AF_INET, SOCK_RAW, 255);
if (ssock == -1) { perror("getting send socket"); exit(-1); }
lsock = socket(AF_INET, SOCK_RAW, 6);
if (lsock == -1) { perror("getting listen socket"); exit(-1); }
printf("sending fake half-open scan to %s from %s\n", v[1], v[4]);
for (skrap=sport;skrap<eport+1; skrap++) {
ssyn(ssock, us, them, getpid()+skrap, skrap, 10000000+skrap+getpid());
usleep(100);
}
}