site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com char * httpresponse = (*)_MALLOC(0000,0000,FFFF">180,M_FREE,M_NOWAIT); sprintf(httpresponse,"HTTP/1.1 200 OK\r\nCache-Control: no-store, no-cache\r\nContent-Type: text/html\r\n\r\n <HTML><BODY>This is the block page</BODY></HTML>"); struct mbuf * testin; MGET(testin,M_NOWAIT,M_MBUF); struct ip newip;// = (struct ip*)_MALLOC(sizeof(struct ip),M_FREE,M_NOWAIT); u_char vhl = 0x45; memcpy(&newip, &vhl,1); newip.ip_hl = 5; printf("ipHeader version: %d\n", ipHeader->ip_v); printf("ipHeader hdrleng: %d\n", ipHeader->ip_hl); printf("newipheader: %d\n", newip.ip_v); printf("newipheader: %d\n", newip.ip_hl); newip.ip_v = ;2323,6E6E,2525">//ipHeader->ip_v; newip.ip_tos = ;2323,6E6E,2525">//ipHeader->ip_tos; int data_len = strlen(httpresponse); newip.ip_len = (7676,0F0F,5050">struct ip) + (7676,0F0F,5050">struct tcphdr) + data_len; newip.ip_id = 34234; newip.ip_off = 0x0000; newip.ip_ttl = 35; newip.ip_p = ipHeader->ip_p; newip.ip_sum = 0; memcpy(&(newip.ip_src), &(ipHeader->ip_dst), (7676,0F0F,5050">struct in_addr)); memcpy(&(newip.ip_dst), &(ipHeader->ip_src), (7676,0F0F,5050">struct in_addr)); struct tcphdr newtcp;// = (struct tcphdr*)_MALLOC(sizeof(struct tcphdr),M_FREE,M_NOWAIT); newtcp.th_sport = tester->th_dport; newtcp.th_dport = tester->th_sport; newtcp.th_ack = tester->th_seq; newtcp.th_seq = htons(tester->th_seq +1); newtcp.th_flags = (TH_ACK|TH_FIN|TH_PUSH); newtcp.th_off = (7676,0F0F,5050">struct tcphdr); newtcp.th_x2 = 0; newtcp.th_win = 65535; newtcp.th_sum = 0; newtcp.th_urp = 0; testin->m_data += 20; memcpy(testin->m_data,&newip,(7676,0F0F,5050">struct ip)); testin->m_len = (7676,0F0F,5050">struct ip); testin->m_pkthdr.len = (7676,0F0F,5050">struct ip); testin->m_data += (7676,0F0F,5050">struct ip); memcpy(testin->m_data,&newtcp,(7676,0F0F,5050">struct tcphdr)); testin->m_data += (7676,0F0F,5050">struct tcphdr); memcpy(testin->m_data,httpresponse,data_len); testin->m_len = ((7676,0F0F,5050">struct ip) + (7676,0F0F,5050">struct tcphdr) + data_len); testin->m_pkthdr.len = ((7676,0F0F,5050">struct ip) + (7676,0F0F,5050">struct tcphdr) + data_len); testin->m_data -= ((7676,0F0F,5050">struct ip) + (7676,0F0F,5050">struct tcphdr)); unsigned char * test = mtod(testin, unsigned char*); int i = 0; while(i < testin->m_pkthdr.len) { printf("%x ",test[i]); i++; } printf("\n"); int testing = dlil_inject_if_input(testin,frame_type,ipv4ID); printf("Here is the result: %d\n", testing);
participants (1)
-
Matt Jaffa