Can a Python API connection be OS agnostic?

In the world of penetration testing with Python, it seems like you need, as a rule, to connect the API to a specific OS. This makes sense to me because we are dealing with different architectures and kernels between OSX, Linux, Windows. But I wonder if this is so?

In addition to some of the limited functionality that you exit from the OS module, I believe that connecting to the OS API will usually be specific to the * POSIX taste (perhaps they have more in common) than on Windows, for example.

In particular, I think of Deviare on Windows. It processes .DLL files. This is pretty much Windows. The moment we hear the DLL, the mind goes to the windows of the earth, .plist OS X and so on.

+6
source share
3 answers

Hook ding is a way to get your own code to execute, if another system is working, then another system, whether it is the OS, graphical user interface, or any other. Somewhat dumb example in Python:

 def Process(records, per_record_hook=None): "adds all records to XYZ system" XYZ = [] for record in records: if per_record_hook: per_record_hook(record) XYZ.append(record) def print_record(record): "print a '.' for each record (primitive counter)" print '.' 

and then later:

 Process(records_from_somewhere, per_record_hook=print_record) 
+7
source

http://en.wikipedia.org/wiki/Hooking

I'm going to suggest that you mean this type of binding? I am completely unfamiliar with this term, but it looks like you are looking for a library that allows you to interact with the operating system?

If so, try something like PyWin32 (google it) or follow some of the methods found here: http://www.rohitab.com/discuss/topic/37018-api-hooking-in-python/

Again, it would be more useful if you could put it (phrase engagement) in more ... Python-esque terms, but I hope this helps?

+2
source

In Python, things like this are usually so trivial that it's hard to even imagine examples. Hooks are usually callbacks, yes. Python callbacks are simply accomplished by passing functions and calling them.

+2
source

All Articles