Let's explore creating files using the unix dd feature. Unix dd utility is a diskduplicator and you can create bogus files that later you can use ethically or unethically within certain packet forge scenarios
For example, if you wanted to create a file & with that data, appended to maybe hping ( -E ) or with sendip ( -f) as a payload. So let's say I want a random data in a file 1meg big. We could easily craft this using cmds
dynamic-90:~ kfelix$ dd if=/dev/random of=./myfile.file bs=1024 count=1000
1000+0 records in
1000+0 records out
1024000 bytes transferred in 0.076096 secs (13456676 bytes/sec)
dynamic-90:~ kfelix$ sh
sh-3.2$ dd if=/dev/random of=./myfile.file bs=1024 count=1000
1000+0 records in
1000+0 records out
1024000 bytes transferred in 0.073255 secs (13978602 bytes/sec)
sh-3.2$
and a quick listing of the file shows
-rw-r--r-- 1 kfelix 1523313980 1024000 Dec 13 17:16 myfile.file
You can confirm the contents using the unix od or hexdump cmd;
e.g
sh-3.2$ od myfile.file
sh-3.2$ hexdump myfile.file
the Data should be randomize
Now let's do the same but using a file padded with zeros
sh-3.2$
sh-3.2$ dd if=/dev/zero of=./myfile.file bs=1024 count=1000
1000+0 records in
1000+0 records out
1024000 bytes transferred in 0.005179 secs (197724302 bytes/sec)
sh-3.2$
sh-3.2$
sh-3.2$ ls -l myfile.file
-rw-r--r-- 1 kfelix 1523313980 1024000 Dec 13 17:20 myfile.file
sh-3.2$
Okay and od and hexdump will show us the contents;
sh-3.2$ od myfile.file
0000000 000000 000000 000000 000000 000000 000000 000000 000000
*
3720000
sh-3.2$
sh-3.2$ hexdump myfile.file
0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
00fa000
sh-3.2$
sh-3.2$ hexdump myfile.file
i hope this was helpful, happy packet forging
Ken Felix
Freelance Network Security Engineer
kfelix a-t hyperfeed dot com
No comments:
Post a Comment