Skip to content

Instantly share code, notes, and snippets.

View vijayanandrp's full-sized avatar
👑

Vijay Anand Pandian vijayanandrp

👑
View GitHub Profile
@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 / 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 / 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 / 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 / Passing messages between "iframe" to Parent frame in JavaScript.js
Created June 14, 2017 22:04
Passing messages between "iframe" to Parent frame in JavaScript
// PARENT - JavaScript (Parent.html)
window.addEventListener('message', function (event) {
console.log("Hello from -> " + event.data);
// Ignores messages from untrusted domains.
//if (event.origin != 'URL of Iframe') return;
});
// IFRAME - JavaScript (child.html)
@vijayanandrp
vijayanandrp / Sleep Sorting Algorithm using Python.py
Created June 14, 2017 21:57
Just 10 lines of code to implement interesting Sleep Sorting Algorithm using Python
#!/usr/bin/env python
from time import sleep
from threading import Timer
def sleep_sort(values):
sleep_sort.result = []
def add1(x):
print 'Appending value in list -> %d' % x
sleep_sort.result.append(x)
@vijayanandrp
vijayanandrp / Sleep Sorting Algorithm using Bash.sh
Created June 14, 2017 21:55
Easy way to implement interesting Sleep Sorting Algorithm using Bash
#!/bin/bash
function f() {
sleep "$1"
echo "$1"
}
while [ -n "$1" ]
do
f "$1" & shift
@vijayanandrp
vijayanandrp / Nullcon HackIM 2014 - Programming 100 Writeup.py
Created June 14, 2017 21:45
Nullcon HackIM 2014 - Programming 100 Writeup
'''
Well I am a beginner.
netcat 23.23.190.204 2002
Welcome
Enter 20 spam words to authenticate yourself.
01/20: spam
02/20: maps
03/20: hot
@vijayanandrp
vijayanandrp / Berlekamp-Massey Algorithm.py
Created June 14, 2017 21:41
Berlekamp–Massey algorithm implemented in Python. (Easy)
# Berlekamp-Massey Algorithm
#from __future__ import print_function
s = [GF(2)(0), 0, 1, 0, 0, 0, 0, 0, 1, 1, 0] #input sequence
n = len(s)
C = [GF(2)(1)]
B = [GF(2)(1)]
@vijayanandrp
vijayanandrp / Fermat Theorem .py
Created June 14, 2017 21:34
Simple python code to solve Factorization Problems - Fermat Theorem
import math
def gcd(a, b):
while a != b:
if a > b:
a = a - b
else:
b = b - a
return a