SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 299 | Next

Shon Harris, Allen Harper, Chris Eagle, and Jonathan Ness

"Gray Hat Hacking, Second Edition"

socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('localhost', 4242))
s.send('Hello, world') # This returns how many bytes were sent
data = s.recv(1024)
s.close()
print 'Received', 'data'
Pretty straightforward, eh? You do need to remember to import the socket library,
and then the socket instantiation line has some socket options to remember, but the rest
is easy. You connect to a host and port, send what youwant, recv into an object, and then
close the socket down. When you execute this, you should see ???Hello, world??? show up
on your NetCat listener and anything you type into the listener returned back to the client.
For extra credit, figure out how to simulate that NetCat listener in Python with the
bind(), listen(), and accept() statements.
Congratulations! You now know enough Python to survive.
References
Python Homepage www.python.org
Good Python Tutorial http://docs.python.org/tut/tut.html
Gray Hat Hacking: The Ethical Hacker??™s Handbook
146
CHAPTER 7 Basic Linux Exploits
In this chapter we will cover basic Linux exploit concepts.
??? Stack operations
??? Stack data structure
??? How the stack data structure is implemented
??? Procedure of calling functions
??? Buffer overflows
??? Example of a buffer overflow
??? Overflow of previous meet.


Pages:
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311