r/Python • u/[deleted] • Sep 09 '12
Hey /r/python, I just released a library to troll Omegle users. This is the first code I've ever released. What do you guys think?
As the title suggests, I am not a professional developer. I started tinkering with python about two years ago I finally found a project that was both interesting enough to keep me engaged, and simple enough for me to make real progress.
This all started with me wanting to learn how HTTP requests worked, and hopefully start doing a bit of white-hat hacking. It turned out to be an excellent crash-course in the matter, and also in asynchronous network I/O. I'm still having trouble believing how much I've learned!
This library is basically an unofficial API for Omegle, but it's definitely geared towards having a bit of fun at its users' expense.
I call it Tromegle: Troll Strangers!
The only attack that's working at the moment is a simple man-in-the-middle attack that lets you spy on a conversation and optionally modify the intercepted messages. I'll be writing a client soon enough (shouldn't be too hard), unless some kind contributor wants to give it a shot =)
After I write the client, I'll probably add an interface to log chats. I'll also look into cookie handling, as this is how Omegle connects you to strangers with similar interests. Doing so would also allow me to probe Omegle's entrails a bit more...
In the interest of "doing it right", I've put some real effort into the documentation. I think the intro on the wiki page is fairly accurate (please point out any errors!) and useful.
So reddit, what do you guys think? How does my code look? Any suggestions from the veterans? Any feature requests?
EDIT: matchu was kind enough to submit a pull request with proper (albeit untested) instructions for installing Twisted under OSX. The forkbomb is no more. Carry on.
2
u/jous Sep 09 '12
Nice documentation!
2
Sep 09 '12
Thanks!
I mean it ... I put more effort into that than any reasonably sane person would ...
2
u/NikEy Sep 09 '12
despite what the others are writing, I think it's a very interesting idea. I doubt this subreddit is interested in it though. I can see a lot of use for this in a social engineering related context. If it could be directional and used in other apps as well (imagine Skype), then it would clearly be backtrack addition worthy
2
Sep 09 '12
If it could be directional and used in other apps as well (imagine Skype), then it would clearly be backtrack addition worthy
Well that certainly is flattering, thank you!
I'm a huge believer in the method of writing one app/library for one very specific purpose. I think it would probably be more beneficial to write separate libraries for Skype and whatnot.
What exactly do you mean by "directional"?
2
u/Plazmotech Sep 09 '12
Wait... I read the documentation, but I still can't figure out how to change the messages. Also, the two people seem to be able to connect to each other. I'm only spying...
2
Sep 10 '12 edited Sep 10 '12
I'm only spying...
This should be the case by default, but if you gave the documentation a whirl, you may have uncovered a bug. Then again, maybe my documentation isn't clear enough.
Could you pastebin the code you wrote?
1
u/Plazmotech Sep 10 '12
The documentation was not clear enough...
I'm just using what it says there.
1
Sep 10 '12
Alright I'll tweak it a bit this afternoon. It sounds like everything is working fine, but that you're unclear on how to use the Transmogrifier class.
I think that you're right, though. I need to add an example at the end where we create a Transmogrifier instance, push spells onto it, and then pass it to a MiddleMan constructor.
Check back in a few hours!
1
1
Sep 10 '12
I added a full example towards the bottom of the the introduction page. Let me know how it works for you.
2
u/flyingfox Sep 14 '12
Four days late, so you'll probably be the only one to see this...
You could (theoretically) also change the names of countries/states/cities randomly. This could lead (hypothetically) to:
Stranger_2: hey m/f?
Stranger_1: F _
Stranger_2: F _
Stranger_2: age?
Stranger_1: 18 u
Stranger_2: 19
Stranger_2: from?
Stranger_1: the China `
Stranger_2: Pakistan `
Stranger_1: lol oh dear
Stranger_2: oh dear? :p
Stranger_1: hows the terrorism going?
Stranger_2: what terrorism
Stranger_1: lol all the terrorist you harbor maybe
Stranger_2: they're in Koln and Miquelon `
Stranger_2: (fail)
Stranger_1: what are you banging on about lmao
Stranger_1 has disconnected.
[Added ` mark signalling location changes. Bolded changes.]
1
Sep 14 '12
Trolling is a art, and you, sir, are a artist.
Have you written any code to do this? If so, I cordially invite you to post it on the recipes page of the github wiki.
2
1
1
u/wsorenson Sep 09 '12
I think the documentation/writeup here is too misleading; calling this a man-in-the-middle attack and claiming you can "inject" messages is a little silly given you're simply wiring two conversations together. I would change it to more clearly state what you're doing rather then imply it allows for some sort of attack or exploitation.
6
u/massivebitchtits Sep 09 '12
But this is a man in the middle attack. Just because you're relaying the data at a higher network layer, doesn't make it any less one. If I make a fake wireless access point and route your traffic to and from the Internet as well as logging it and possibly modifying it I am exactly "wiring to conversations together" the two conversations are the conversation between the victim and me and the conversation between me and the Internet. In short, man in the middle is not so much a specific attack as a whole class of attacks.
1
Sep 10 '12 edited Sep 10 '12
I'm upvoting you because I initially hesitated to call it a man-in-the-middle attack. I just found out a couple of hours ago that it is, in the strictest sense, such an attack.
I figure that if I can make the mistake, so can others.
Themoreyouknow
1
u/fuckratheism Sep 10 '12
I'm learning python at the moment as well (learn python the hard way) and I'm wondering what tutorials/resources you used to start doing HTTP stuff as I'd like to do web testing and think this would be a good place to start learning.
1
Sep 10 '12 edited Sep 11 '12
I had a pretty solid grasp of C/C++ fundamentals before diving into python. To be honest, I think it helped a lot, so I would recommend doing the first 30 or so lessons from /r/carlhprogramming before doing python (assuming it's your first language). Others may disagree, but I attribute much of my ease with python to a solid understanding of pointers and OOP.
Beyond that, I found StackOverflow to be an indispensable resource, and the same is true of this subreddit and IRC.
Here's some random advice/personal epiphanies in no particular order:
urllib and urllib2 are good libraries, but the API is kind of crappy. If I had do scrappy all over again, I'd use the Requests library instead. I might actually rewrite it just for the hell of it.
Twisted is awesome. Learn to use it. This page taught me everything I needed to know to write Tromegle. #Twisted and #Python helped me with case-specific issues.
In a similar vein, dictionaries are a great way of handling callbacks.
You probably don't need threads, processes, or any true form of concurrency.
Github is really awesome.
EDIT: I'm extremely curious as to why this was downvoted...
2
u/matchu Sep 09 '12
I dunno, the lesson I learn from the forkbomb is that this project's developer is an untrustworthy ass who derives pleasure from tricking people into running malicious code. No way in hell am I even downloading a project from that developer, much less running it.
Submitted a pull request that removes the evil from the README. Please, for the love of all things holy or even just moderately responsible, merge immediately.
2
u/jmoiron Sep 10 '12
I just figured the author is a child, as it's hard to imagine something less mature. Stupid meme username, first project is a toolkit to facilitate "trolling", script kiddie forkbomb and huffs and puffs about it being an educational warning.
0
0
Sep 09 '12
[deleted]
5
Sep 09 '12
Oh hi there!
You'll be pleased to know that you're the inspiration for this project! I cloned your repository and read through your code, after which I said, "Huh. That's really cool!"
In fact, I still have pyomegle.py sitting (unstaged) in my tromegle directory.
2
u/D__ Sep 09 '12
Apparently pyomegle and py-omegle are not the same thing. I used the latter for similar purposes a while back but, like pyomegle, it is also quite old now and doesn't incorporate the new Omegle features.
1
1
u/AgonistAgent Student - Content Analysis Sep 09 '12
I remember that! Fun library - got some MegaHAL bindings setup, plenty of shenanigans.
0
Sep 09 '12
[deleted]
3
Sep 09 '12 edited Sep 10 '12
Maybe my understanding of "man-in-the-middle" is incorrect. As I understand it, MITM just means you're relaying information from party A towards party B while claiming to be party A, and vice versa.
Am I mistaken?
EDIT: It's burried in the comment thread somewhere, but according to wikipedia, this is a strict example of man-in-the-middle.
0
Sep 09 '12
[deleted]
3
Sep 09 '12
... but you are the third party...
There's Stranger_1 and Stranger_2. You're connected to both.
EDIT: now I'm worried about having not understood something. Back to wikipedia I go... =/
0
Sep 09 '12
[deleted]
0
Sep 09 '12
Yeah, I've often noticed that, but I like to use to figure out which technical terms I don't know or understand. From there I usually google those terms until I find something on at my level.
0
0
Sep 09 '12
[deleted]
0
Sep 09 '12
No, because in question mode the users know they're being watched.
They're not being prompted with a question here and they have no indication that they're being observed. What's more, you can change the contents of their messages before forwarding them.
0
Sep 09 '12
[deleted]
7
u/rayo2nd Sep 09 '12
He just opens 2 chats at the same time, forwarding all msgs from chat A to Chat B and all from Chat B to Chat A.
0
Sep 09 '12 edited Sep 09 '12
It's absolutely a security hole in the strictest sense. I also think they don't give a flying fart on a magic carpet. Complete strangers are almost certainly not trading sensitive information. =)
Have you looked at the wiki? I like to think it's fairly complete. If not, I'd be happy to clarify, but here's the relevant portion.
BTW, I really appreciate your fact-checking! If I'm wrong about something, I really would prefer to know!
EDIT: I missed a golden opportunity to respond with "Nice try, Omegle devs"
0
Sep 09 '12
[deleted]
2
u/isdnpro Sep 10 '12
Nice. But it's not really man-in-the middle.
Yeah, it is. Hell, if you needed an example for the dictionary this would be pretty much perfect.
→ More replies (0)0
0
Sep 09 '12
But it's not really man-in-the middle. I would rather describe it as proxy.
Oh I think I see your point. For it to be MITM, I'd have to sit between a user's computer and the omegle servers... is that right?
→ More replies (0)
19
u/sjustinas Sep 09 '12
No.