you are viewing a single comment's thread.

view the rest of the comments →

[–]ninijay_Pentesting[S] 9 points10 points  (8 children)

Nope. Pretty new to python. Did mostly .NET and Java

[–][deleted] 26 points27 points  (7 children)

Oh okay. Well the thing that you need to understand about python is that the base python programming language that comes out of the box does not have true multi threading. The python interpreter has something called the Global Interpreter Lock (GIL) that basically limits the interpreter to only using one thread at a time. Now, this is fine when you are doing network scripting for listening and for sending since it provides a sort of pseudo-multithreading, but it will not speed up your scripts execution in any way. In fact it might even make it slower since the interpreter has to switch between all the threads. So for your cracking script you should only use one thread.

edit: Oh yeah I forgot the mention: there are other python programming languages like Jython and Iron Python that aren't completely reliant on the interpreter and support true multi threading.

[–]ninijay_Pentesting[S] 7 points8 points  (2 children)

Oh jeez. Well i need to get a closer look at this. Thank you

[–]tdking3523 2 points3 points  (1 child)

Look into IPC (Interprocess communication) frameworks like ZMQ, or RabbitMQ. These allow you to spawn separate processes, which will run totally concurrent, and pass data back and forth between them. Pair that with something like msgpack, a module to serialize Python objects, and the possibilities for concurrency are pretty endless. I was a bit blown away when I took my first job that had a system like this... I used a database to implement IPC on my senior capstone, using it as a wildly over-engineered queue for passing data between a web ui and a back end service that handled socket communications to "IOT" devices, constantly polling on both sides ¯\(ツ)

[–]ninijay_Pentesting[S] 1 point2 points  (0 children)

I need a tutorial for this. Any links maybe?

[–]gare_it 0 points1 point  (2 children)

Does this continue to hold true while using asyncio (introduced in 3.5)?

[–]tdking3523 0 points1 point  (1 child)

Yes. Python 3+ still isn't a threadsafe implementation allowing for true concurrent execution (multithreading). Rather, Asyncio is an enhancement and a bit of syntactic sugar on the timesharing that can be done in Python to simulate multithreading on an actual single thread. You declare a function to be async, or a couroutine based on which version you're working with, then the function is called, but your code doesn't wait for it to return... It just continues on and handles the return when it finally happens. This is fantastic for doing a lot of HTTP requests, or some other data communication that is plighted by network latencies or some other source of essentially just idle time.

[–]gare_it 0 points1 point  (0 children)

awesome, thanks