Skip to content

Instantly share code, notes, and snippets.

View vijayanandrp's full-sized avatar
👑

Vijay Anand Pandian vijayanandrp

👑
View GitHub Profile
@vijayanandrp
vijayanandrp / Netcat - Swiss Army Knife for TCP IP.txt
Created June 14, 2017 22:07
Learn Netcat - Swiss Army Knife for TCP/IP in 5 minutes !!
Netcat
======
The Netcat tool is known as the Swiss Army knife for TCP/IP connections.
(netcat or nc both are same)
nc -h
netcat -h
man netcat
@vijayanandrp
vijayanandrp / Do you know Easter Egg inside Python ? what is the design philosophies underlying python - Click Here Learn !!.py
Created June 14, 2017 22:10
Do you know Easter Egg inside Python ? what is the design philosophies underlying python - Click Here Learn !!
import this
'''
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
@vijayanandrp
vijayanandrp / xor_decipher.py
Created June 15, 2017 05:19
Writeup for InCTF 2014 - Crypto 100 - XOR decipher
#!/usr/bin/env python
 
import hashlib
 
 
"""
one.txt
This sentence is encrypted using XOR cipher.
"""
 
@vijayanandrp
vijayanandrp / file_concepts.py
Created June 15, 2017 21:38
Learn file concepts in python - Read time - 5 mins!!
#!/usr/bin/env python
# Just for practicing the file operation in python
def file_basics():
print ' File Operations\n', '*' * 80
types_of_file = """
Text Files represent content as normal str strings, perform unicode and decoding automatically (plain)
@vijayanandrp
vijayanandrp / List and Dict Python concepts.py
Created June 15, 2017 21:40
How to do I understand List and Dict Python concepts in just 5 mins!!
#!/usr/bin/env python
def lists_examples():
print 'List examples in Python\n', '======================================'
L = []
L = ['abc', 123, 1.23, {}]
L = ['Bob', 40.0, ['dev', 'mgr']]
@vijayanandrp
vijayanandrp / How to do I understand strings Python concepts in just 5 mins.py
Created June 15, 2017 21:43
How to do I understand strings Python concepts in just 5 mins!!
#!/usr/bin/env python
def main():
print int('5')
print ord('s')
print chr(115)
print bin(13)
print hex(26)
print hex(255)
print oct(255)
@vijayanandrp
vijayanandrp / Simple examples to understand Sets in Python.py
Created June 15, 2017 21:45
Simple examples to understand Sets in Python
#!/usr/bin/env python
"""
Set - an unordered collection of unique and immutable objects
"""
def main():
x = set('abcdef')
y = set('bdexyz')
@vijayanandrp
vijayanandrp / ip_address_class_selector.py
Created June 15, 2017 22:08
How to do IP Address Class Identification using python program?
#!/usr/bin/python
import sys, getopt
def __help():
sys.stderr.write('\n Usage: \n ip_classifier.py -h \n ip_classifier.py --help \n ip_classifier.py -i 128.12.14.23 \n ip_classifier.py --ipv4=128.12.14.23 \n ')
sys.exit()
@vijayanandrp
vijayanandrp / Learn XML - parsing in python with simple examples.py
Created June 15, 2017 22:19
Learn XML - parsing in python with simple examples
# 1. How to read and XML file using Python ?
# For example purpose, kindly save the above XML content into a file named as 'data.xml'
# import a class named xml.etree.ElementTree
import xml.etree.ElementTree as element_tree
# Before reading we should parse the whole XML file content as tree
tree = element_tree.parse('data.xml')
# Now with tree we have to fetch the root
@vijayanandrp
vijayanandrp / Step by Step method to parse XML files and store into sqlite db and vice versa.py
Created June 15, 2017 22:24
Step by Step method to parse XML files and store into sqlite db and vice versa
__author__ = 'admin'
import sqlite3
db = sqlite3.connect('books_store.db')
cursor = db.cursor()
try:
cursor.execute('''DROP TABLE books''')
print 'Deleted the old table'