Commit 696958af authored by robertdavidgraham's avatar robertdavidgraham
Browse files

socket

parent e8f1d4ca
Loading
Loading
Loading
Loading
+36 −3
Original line number Diff line number Diff line
@@ -42,7 +42,14 @@
#include <stdlib.h>
#include <signal.h>


#if defined(WIN32)
#include <WinSock.h>
#pragma comment(lib, "Ws2_32.lib")
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#endif

unsigned control_c_pressed = 0;
time_t global_now;
@@ -742,6 +749,29 @@ main_scan(struct Masscan *masscan)
    }


#if 0
    {
        int fd = (int)socket(AF_INET, SOCK_STREAM, 0);
        if (fd <= 0) {
            perror("socket");
        } else  {
            struct sockaddr_in sin;
            memset(&sin, 0, sizeof(sin));
            sin.sin_family = AF_INET;
            sin.sin_port = htons((unsigned short)masscan->adapter_port);
            sin.sin_addr.s_addr = 0;

            if (bind(fd, (struct sockaddr*)&sin, sizeof(sin)) != 0) {
                perror("bind");
            } else {
                int x = listen(fd, 5);
                if (x != 0)
                    perror("listen");
            }
            
        }
    }
#endif
    

    /*
@@ -761,7 +791,6 @@ main_scan(struct Masscan *masscan)
            adapter_mac);



    return 0;
}

@@ -772,6 +801,10 @@ int main(int argc, char *argv[])
{
    struct Masscan masscan[1];

#if defined(WIN32)
    {WSADATA x; WSAStartup(0x101, &x);}
#endif

    global_now = time(0);

    /*
+2 −1
Original line number Diff line number Diff line
@@ -696,8 +696,9 @@ tcpcon_handle(struct TCP_ConnectionTable *tcpcon, struct TCP_Control_Block *tcb,
    case STATE_READY_TO_SEND<<8 | TCP_WHAT_FIN:
        tcb->seqno_them = seqno_them + 1;
        tcpcon_send_packet(tcpcon, tcb,
                    0x14, /*reset */
                    0x11, /*reset */
                    0, 0);
        tcpcon_destroy_tcb(tcpcon, tcb);
        break;

   case STATE_PAYLOAD_SENT<<8 | TCP_WHAT_SYNACK: