Prev Contents Next

Raw packet method descriptions

data(s)
This puts a string s into the packet resulting in a payload at the end of the packet after the normal packet headers.
flags(i)
With flags you can set the TCP-flags from a packet. This makes this method only available when having defined a TCP-protocolish packet. In the future this method may move to options. The flags can be put in subsequently after eachother like this:
packet.flags(btk.SYN | btk.FIN)
The flags available are:
SYN, FIN, ACK, URG, RST, PUSH, CWR, ECN
For their meaning look in the corresponding RFC's meantioned in the References section from this manual
options(...)
A lot of options can be set for the packets. This method works with keywords representing a special value to be set in your raw packet.
seq
Sequence number (TCP)
ack
Acknowledgement (TCP)
urp
Urgent pointer (TCP)
win
Window size (TCP)
off
Offset (IP)
tos
Type Of Service (IP)
ttl
Time to Live (IP)
id
Identification number (IP)
type
ICMP type
code
ICMP code
gateway
String with gateway (ICMP type 5)
address_mask
String with address_mask (ICMP type 17/18)
time_orig
Original Time (ICMP type 13/14)
time_recv
Received Time (ICMP type 13/14)
time_tsmt
Transmitted Time (ICMP type 13/14)
pointer
Data with parameter problem (ICMP type 12)
no_addr
No. of adresses (ICMP type 9)
entry_size
Entry size(ICMP type 9)
lifetime
Lifetime (ICMP type 9)
icmp_id
ICMP id number
icmp_seq
ICMP sequence number
These are the options currently available. If you set an ICMP option but afterwarts you'll send a TCP-packet the other options won't have any impact on your raw packet.
protocol(i)
Specify the protocol type of the packet. At the moment only IP-based protocols are supported.
TCP, UDP, ICMP
More protocols to be added soon!
send(dstip, dstport, srcip, srcport)
The send method allows you to finally assemble the packet and set it out into the wide web. You can't (for now) specify hostnames so you'll have to look up the IP and fill it in. Note that the ip's are expected to be strings and the ports are expected to be integers.

Prev Contents Next