Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
from scapy.all import *
ip = IP()
icmp = ICMP()
icmp.type = 3
ip_orig = IP()
ip_orig.src = "192.168.2.30"
ip_orig.dst = "192.168.2.1"
ip.src = "192.168.2.1"
ip.dst = "192.168.2.30"
@thommyj
thommyj / sendpackets.c
Last active December 17, 2015 20:49
send packet
#include <sys/socket.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#include <linux/if_arp.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <netinet/udp.h>
#include <stdio.h>
void displayOptions(char *name){
printf("\r\nUsage: %s word1 word2\r\n",name);
}
#include <stdio.h>
void displayOptions(char *name){
printf("\r\nUsage: %s word1 word2\r\n",name);
}
@thommyj
thommyj / blobfind.c
Created August 20, 2012 10:44
Find binary file inside other binary file
#include <stdio.h>
#include <stdlib.h>
int main(int argc,char **argv)
{
FILE *afile = NULL;
FILE *bfile = NULL;
unsigned char *bbuffer = NULL;
int achar;
int bsize;
@thommyj
thommyj / reorder32.c
Created April 27, 2012 11:21
reorder endian in 32bit words
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
unsigned long bswap32 (unsigned long ul)
{
return ((ul & 0x000000FF) << 24) | ((ul & 0x0000FF00) << 8) |
((ul & 0x00FF0000) >> 8) | ((ul & 0xFF000000) >> 24);
}