how to run a scripted scan with openVAS [Python] - python

I have recently installed the scanner openVAS in my kali linux operating system ... what I would like to do is run scans of my ip from a python executable and then print the results on the screen. I have seen the OpenVAS python API documentation and tried some examples, but it always comes up with an error or something that does not allow me to achieve my goal.
Could you recommend a working example or where is it explained correctly in the docuementation?
thank you.

Related

How to get libCEC for Python (PyCharm on Windows)?

I am unfortunately an absolute beginner in programming.
First of all, I'm programming with the PyCharm IDE on a Windows computer, but the script will later run on a RaspberryPi.
I want to turn on my TV with a Python script via HDMI-CEC and I came across libcec.
However, I can't figure out the setup instructions for Windows.
https://github.com/trainman419/python-cec
Can anyone give me a step by step guide on what exactly I need to do to use the CEC commands in Python?
Or should I program with PyCharm directly on the RaspberryPi? This one is way too slow for this task in my opinion. Then I could install the CEC library very easily.
Thanks for your help.

Using Jenkins to run Python script but having issue importing modules on the script

I am really new to Jenkins and Python so when I have initially researched for this problem, there has been a limit to my understanding. I am looking to write a Python script and for it to be run on Jenkins as part of some automated testing I wish to do. My script interacts with an API and hence imports the 'requests' module on Python. It works fine using the Python interpreter on my local machine but I have had issues when I have tried using the Jenkins Python script builder and so I am looking for a way around this.
As I mentioned, I have looked around the internet for solutions but as my knowledge on this topic is limited I have found it difficult to understand certain ideas that have been mentioned on the web. One lead I have had is related to the use of virtual environments on Jenkins, but as its something I've never used, I have struggled implementing it. I have installed the ShiningPanda Plugin on Jenkins, but I am unsure how to use it.
Any help given is greatly appreciated :)
Thanks

How to protect my Python scripts on Raspberry Pi?

I have developed a long and complex computer vision algorithm on Python. I insist on the "long and complex" because my very last solution would be to rewrite it with C++ (it's about 3 000 lines long and depends on pure Python libraries)...
This algorithm is embedded on a Raspberry Pi A+. It is possible to plug an SD card to this nanocomputer, so that it includes a Linux system.
So basically my script is in a folder in that SD. When the Raspberry Pi is switched on, it runs the system and then executes my code.
Let's say someone retrieve this SD card. How can I be sure that he won't be able to get to my script ?
I've read it was difficult to obfuscate Python code, is it still true ? Let's say I would rename all of my variables with absurd names, to "scramble the tracks". Are there programs that can retrace the structure of the whole algorithm ?
Regarding the SD card itself, is it possible to protect it ?
What I am actually doing is I deactivate the HDMI and USB port when the Raspberry Pi is launched, and protect the SSH connexion with a password.
Do you think this is enough, or is there other ways someone can get to the script ?
Finally, rewritting it in C++... Would it ensure me that it would be 100% protected ?!
Thank you in advance. :)
I think your best solution would be to compile your Python file using a bundling tool.
See Compiling Python Code.
For example using PyInstaller
pip install pyinstaller
pyinstaller yourprogram.py
Although you can never (even with C++) guarantee full "protection". There are techniques like reverse engineering that can be used to reveal your algorithm.

Pretty print in Eclipse CDT: unable to look at any variable

I'm developing a QT based application on ARM, iMX6 device.
Using toolchain from Freescale and Eclipse CDT Kepler, I would like to use pretty printer with GDB.
I followed the tutorial on http://anadoxin.org/blog/node/98 and the setup seems fine (no error while starting GDB).
However when looking at debug view panel, I'm not able to look at any datatype (not only QT but also int, double etc, the whole panel is blank. Furthermore also writing print variable to gdb Eclipse console doesn't generate a valid output).
I think my setup is fine:
GNU gdb (GDB) 7.6 for ARM device
Python: Python 2.7.3
Eclipse: Kepler
KUbuntu 12.04
Is there anyone that can help me understand what is wrong?
Can I send any command to gdb console in order to understand why pretty printer aren't working fine, and even worse, they corrupt the whole gdb debug view variables?
Any help will be really appreciated
I finally fixed it.
The problem was that my toolchain for ARM was built without the support for Python in GDB. If you search the web, you will find that there is a flag in the configuration named (--with-python).
Using it and rebuilding gdb, you will be able to use the python scripts available at
Pretty printers
Hope this will be helpful for the stackoverflow community.
best regards

How to run a Python program on a Windows server without having Python installed?

So I wrote a Python script which does some simple stuff. It was originally going to run on a Unix server but due to crappy network security settings which TPTB refuse to change, we need to run it on a Windows server instead. However, the administrators of said Windows server refuse to do anything helpful like install Python.
What are my options for running a Python script on Windows without Python?
Consideration 1:
Something like Py2Exe - I found this after a quick Google search and it seems promising. From what I can tell, it'll generate a bunch of files but we can just xcopy that directory to our Windows machine and it will be completely isolated and not have any external dependencies. Does anyone have any insight on how well this works? Obviously, it depends on my Python script but fortunately this script is quite simple and only uses built in Python libraries such as urllib2 and urlparse.
Consideration 2:
We can assume the Windows server has at least some version of the .NET Framework installed too, which brings IronPython to mind. I've never used this before, but I've always wanted to. From what I can tell, it will compile Python code into CLS compliant IL code which can be run natively under the .NET runtime. However, does this require additional .NET libraries to be installed on the server? Can I just bundle those DLLs with my program? Or, does it require I rewrite my Python script to call into .NET Framework specific classes instead of using things like urllib2 or urlparse?
Thanks!
PS - The ironic part: I actually barely know Python and I'm a .NET expert, but I wrote the script in Python because I was told it would run on a Unix server. Had I known we'd end up running this on a Windows server, I'd have written the thing in C# to begin with in about 1/10th of the time. Fail.
Will they let you copy executables onto the server at all? If so then you should be able to do a non-admin installation of Python or use Portable Python which can just be copied into a folder without any installation at all.
Nothing wrong with Py2exe, but it does mean you then have to build the script into a fresh executable each time you update it. Also Py2exe has a slightly longer startup time than a Python interpreter because it has to extract the Python dlls into a temporary folder each time it runs; that only matters of course if you run your script a lot.

Categories

Resources