ScaPySnippets

From C4 Wiki
Jump to: navigation, search

Post all your ScaPy Code Snippets here:

Basic Fuzzer:

send(IP(dst="137.226.113.203", id=RandShort(), proto=RandNum(125,160),
        src=RandIP("0.0.0.0/0"),flags=RandNum(0,7),
        options=RandString(RandNum(0,39)))/Raw(load=RandString(RandNum(0,50))),
     loop=1)
send(IP(dst=”XXX.XX.XX.XXX”, id=RandShort(), proto=RandNum(0,255),src=”XXX.XX.XX.XXX”,
        flags=RandNum(0,7), options=RandBin(RandNum(0,39)))/ \
        Raw(load=RandBin(RandNum(0,50))),loop=1)
 class RandBin(RandField):
       def __init__(self, size, bytes="\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09..."):
               self.bytes = bytes
               self.size = size
       def byteseq(self):
               s = ""
               for i in range(self.size):
                       s += random.choice(self.bytes)
               return s
       def __getattr__(self, attr):
               return getattr(self.byteseq(), attr)