Example #1
0
main(int argc, char *argv[])
{
    int   len;
    char *infile;
    char *conn_name;
    char *pcap1in;
    char *pcap2in;
    char *pcap_out;
    int  lineno=0;
    int regression;
    struct connection *c1;
    struct state *st;

    EF_PROTECT_FREE=1;

    progname = argv[0];
    leak_detective = 1;

    /* skip argv0 */
    argc--; argv++;

    if(strcmp(argv[0], "-r")==0) {
        regression = 1;
        argc--; argv++;
    }

    if(argc != 5) {
	fprintf(stderr, "Usage: %s <whackrecord> <conn-name> <pcapin1> <pcapin2> <pcapout>\n", progname);
	exit(10);
    }

    tool_init_log();
    init_crypto();
    load_oswcrypto();
    init_fake_vendorid();
    init_jamesjohnson_interface();
    init_seam_kernelalgs();

    infile = argv[0];
    conn_name = argv[1];
    pcap1in   = argv[2];
    pcap2in   = argv[3];
    pcap_out  = argv[4];

    cur_debugging = DBG_CONTROL|DBG_CONTROLMORE;
    if(readwhackmsg(infile) == 0) exit(10);
    c1 = con_by_name(conn_name, TRUE);
    assert(c1 != NULL);

    assert(orient(c1, 500));
    show_one_connection(c1);

    /* omit the R1 reply */
    send_packet_setup_pcap("/dev/null");

    /* setup to process the I1 packet */
    recv_pcap_setup(pcap1in);

    /* process first I1 packet */
    cur_debugging = DBG_EMITTING|DBG_CONTROL|DBG_CONTROLMORE;
    pcap_dispatch(pt, 1, recv_pcap_packet, NULL);

    /* set up output file */
    send_packet_setup_pcap(pcap_out);
    pcap_close(pt);

    /* now process the I2 packet */
    recv_pcap_setup(pcap2in);

    cur_debugging = DBG_EMITTING|DBG_CONTROL|DBG_CONTROLMORE;
    pcap_dispatch(pt, 1, recv_pcap_packet2, NULL);

    /* clean up so that we can see any leaks */
    st = state_with_serialno(1);
    if(st!=NULL) {
        free_state(st);
    }

    report_leaks();

    tool_close_log();
    exit(0);
}
Example #2
0
static void init_local_interface(void)
{
    init_jamesjohnson_interface();
}
Example #3
0
int main(int argc, char *argv[])
{
    int   len;
    char *infile, *pcapin, *pcapout;
    char *conn_name;
    int  lineno=0;
    struct connection *c1;
    struct state *st;
    char   eb1[256];  /* error buffer for pcap open */

#ifdef HAVE_EFENCE
    EF_PROTECT_FREE=1;
#endif

    progname = argv[0];
    leak_detective = 1;

    if(argc <= 4) {
    usage:
	fprintf(stderr, "Usage: %s <whackrecord> <conn-name> <pcapin> <pcapout>\n", progname);
	exit(10);
    }
    /* argv[1] == "-r" ?? */

    tool_init_log();
    init_crypto();
    init_fake_vendorid();
    init_fake_secrets();
    init_jamesjohnson_interface();

    infile = NULL;
    conn_name = NULL;
    pcapin  = NULL;
    pcapout = NULL;
    argc--; argv++;
    if(argc > 0) {
        infile = argv[0];
        argc--; argv++;
    }
    if(argc > 0) {
        conn_name = argv[0];
        argc--; argv++;
    }
    if(argc > 0) {
        pcapin = argv[0];
        argc--; argv++;
    }
    if(argc > 0) {
        pcapout = argv[0];
        argc--; argv++;
    }
    if(conn_name == NULL ||
       infile    == NULL ||
       pcapin    == NULL ||
       pcapout   == NULL) {
        goto usage;
    }

    cur_debugging = DBG_CONTROL|DBG_CONTROLMORE;
    if(readwhackmsg(infile) == 0) exit(10);
    c1 = con_by_name(conn_name, TRUE);
    assert(c1 != NULL);

    assert(orient(c1, 500));
    show_one_connection(c1, whack_log);

    send_packet_setup_pcap(pcapout);

    /* setup to process the I1 packet */
    recv_pcap_setup(pcapin);

    cur_debugging = DBG_EMITTING|DBG_CONTROL|DBG_CONTROLMORE;
    pcap_dispatch(pt, 1, recv_pcap_packet, NULL);

    /* clean up so that we can see any leaks */
    st = state_with_serialno(1);
    if(st!=NULL) {
        delete_state(st);
        free_state(st);
    }

    delete_connection(c1, TRUE);

    report_leaks();

    tool_close_log();
    exit(0);
}