Category Archives: Scripting

[python]Code snippet to encrypt and decrypt password.

This is a code snippet which i want to use to store a password input by user, and encrypt it. My intention is to test this code snippet so that I can store the ciphertext in a file, and decrypt … Continue reading

Posted in Python, Scripting | Tagged , , , | Leave a comment

[Python]Adding firewall rules to Palo Alto using PA REST API

I was experimenting on adding firewall rules using the Palo Alto REST API. Did a few tries and finally got the result. This code is very static, the intent is to test how to organize the xml elements so that … Continue reading

Posted in Python, Scripting | Tagged , | Leave a comment

[python]Simple tcp client

So here’s the simple code: So first create an object client, the attributes are IPV4 (socket.AF_INET) and tcp (socket.SOCK_STREAM). Use the send method to send http request, must send the msg in bytes, hence the b.

Posted in Python, Scripting | Tagged , , | Leave a comment

[python]Intrusive python: Reacting with interactive prompt with pexpect

Ok, I am reading some stuffs about brute forcing ssh server. So here is a python module that deals with possible interactive prompts. The target server is a cisco router, I have put in all possible expected prompts.Such as: 1. … Continue reading

Posted in Python, Scripting | Tagged , | Leave a comment

[python]Intrusive python with nmap

So i was trying some simple script to invoke nmap with python. So here is a python command line version. The python script takes in two types of arguments: a. target host b. target port/ports. the port if more than … Continue reading

Posted in Python, Scripting | Tagged , , | Leave a comment

[python]Intrusive python with nmap

Just got a new python-nmap installed, and nmap installed on my mac, did a small try out on manipulating the result. here’s the code: I will be trying out the full scan capability with the codes, the above is just … Continue reading

Posted in Python, Scripting | Tagged , | Leave a comment

[python]Exception handling with pan-python

pan.xapi has its own error handling, so on previous post i updated the code with exception handling. I actually tested with wrong credential, I could see the http 403 forbidden error raised. Which is good, as I would know what … Continue reading

Posted in Python, Scripting | Tagged , , , , | Leave a comment