Login Register






usable netcat in 99 lines of python filter_list
Author
Message
usable netcat in 99 lines of python #1
uhhh, Hopefully somebody finds this helpful. Only literally like 1% of this is my code, so no credit for me i just thought you guys might enjoy this!

Code:
import sys,socket,getopt,threading,subprocess l=False;c=False;u=False;e="";t="";d="";p=0 def RC(C): C=C.rstrip() try:O=subprocess.check_output(C,stderr=subprocess.STDOUT,shell=True) except:O="exe fail\n" return O def CH(CS): global u,e,c if len(d): fb="" while True: da=CS.recv(1024) if not da: break else: fb+=da try: file_descriptor=open(d, "wb") file_descriptor.write(fb) file_descriptor.close() CS.send("Pass %s\n" % d) except: CS.send("Fail %s\n" % d) if len(e): op=RC(e) CS.send(op) if c: while True: CS.send(": ") cb="" while "\n" not in cb: cb += CS.recv(1024) r=RC(cb) CS.send(r) def SL(): global t,p if not len(t): t="0.0.0.0" S=socket.socket(socket.AF_INET, socket.SOCK_STREAM) S.bind((t, p)) S.listen(5) while True: client_socket, addr=S.accept() client_thread=threading.Thread(target=CH, args=(client_socket,)) client_thread.start() def sn(bu): cl=socket.socket(socket.AF_INET,socket.SOCK_STREAM) try: cl.connect((t,p)) if len(bu): cl.send(bu) while True: recv_len=1 re="" while recv_len: da=cl.recv(4096) recv_len=len(da) re+=da if recv_len<4096: break print re, bu=raw_input("") bu+="\n" cl.send(bu) except: print "Excpt" cl.close() def use(): print "Use: nc.py -t target_host -p port" print "-l listen" print "-e exec=file" print "-c command" print "-u upload=path" sys.exit(0) def main(): global l,p,e,c,d,t if not len(sys.argv[1:]): use() try: opts, args=getopt.getopt(sys.argv[1:], "hle:t:p:cu:") except getopt.GetoptError as err: print str(err) use() for o, a in opts: if o in ("-h"):use() elif o in ("-l"):l=True elif o in ("-e"):e=a elif o in ("-c"):c=True elif o in ("-u"):d=a elif o in ("-t"):t=a elif o in ("-p"):p=int(a) else: assert False, "bad option" if not l and len(t) and p > 0: bu=sys.stdin.read() sn(bu) if l: SL() main()
Help, i need my peasant status removed! Donate to me.

>> https://www.sinister.ly/newpoints.php?action=donate <<

(contact me): xmpp: mental_neglect@dukgo.com







































































Reply

RE: usable netcat in 99 lines of python #2
this is some of the most shitty code i've ever seen in my whole life

[+] 1 user Likes A5^'s post
Reply

RE: usable netcat in 99 lines of python #3
(08-22-2015, 08:48 PM)A5^ Wrote: this is some of the most shitty code i've ever seen in my whole life

Please, share some of your code?
Help, i need my peasant status removed! Donate to me.

>> https://www.sinister.ly/newpoints.php?action=donate <<

(contact me): xmpp: mental_neglect@dukgo.com







































































Reply

RE: usable netcat in 99 lines of python #4
(08-22-2015, 08:48 PM)A5^ Wrote: this is some of the most shitty code i've ever seen in my whole life

Something makes me think this wasn't written to be pretty. Get over it.
[Image: BXqGARG.png]

Reply

RE: usable netcat in 99 lines of python #5
Why... Why the fuck is this written so horribly? Did you upload this on here with the intention of making it ugly?

(08-22-2015, 08:52 PM)Stocking Wrote: Something makes me think this wasn't written to be pretty. Get over it.

It doesn't even work as is from the thread. It's literally too ugly to function correctly.
Using "it wasn't written to be pretty" is a bad excuse. No code should be ugly if it can be made pretty.

Also don't ask me to share some of my code. I'm rewriting your atrocity, I'll post it when I'm done.

[+] 1 user Likes lola's post
Reply

RE: usable netcat in 99 lines of python #6
(08-22-2015, 08:53 PM)lola Wrote: It's literally too ugly to function correctly.



truth m3n rifk irl

Reply

RE: usable netcat in 99 lines of python #7
(08-22-2015, 08:53 PM)lola Wrote: Why... Why the fuck is this written so horribly? Did you upload this on here with the intention of making it ugly?


It doesn't even work as is from the thread. It's literally too ugly to function correctly.
Using "it wasn't written to be pretty" is a bad excuse. No code should be ugly if it can be made pretty.

Also don't ask me to share some of my code. I'm rewriting your atrocity, I'll post it when I'm done.

Are you that lola kid from TeamP0ison? please say you are so i can laugh. X'D
Help, i need my peasant status removed! Donate to me.

>> https://www.sinister.ly/newpoints.php?action=donate <<

(contact me): xmpp: mental_neglect@dukgo.com







































































Reply

RE: usable netcat in 99 lines of python #8
(08-22-2015, 09:01 PM)Nightlife Wrote: Are you that lola kid from TeamP0ison? please say you are so i can laugh. X'D

No. I made this account before that alias was used by that person. Sorry to disappoint.

Reply

RE: usable netcat in 99 lines of python #9
(08-22-2015, 09:02 PM)lola Wrote: No. I made this account before that alias was used by that person. Sorry to disappoint.

awwwww. ok
Help, i need my peasant status removed! Donate to me.

>> https://www.sinister.ly/newpoints.php?action=donate <<

(contact me): xmpp: mental_neglect@dukgo.com







































































Reply

RE: usable netcat in 99 lines of python #10
(08-22-2015, 08:53 PM)lola Wrote: Why... Why the fuck is this written so horribly? Did you upload this on here with the intention of making it ugly?


It doesn't even work as is from the thread. It's literally too ugly to function correctly.
Using "it wasn't written to be pretty" is a bad excuse. No code should be ugly if it can be made pretty.

Also don't ask me to share some of my code. I'm rewriting your atrocity, I'll post it when I'm done.

I see where you're coming from tbh, just not as extreme as you make it out to be. Too many if-else and print statements for my liking.

Reply