Skip to content

Instantly share code, notes, and snippets.

View prongs's full-sized avatar

Rajat Khandelwal prongs

View GitHub Profile
define(["dojo/_base/declare","dojo/dom",
"dijit/_Widget", "dijit/_TemplatedMixin",
"dojo/text!./templates/MainViewWidget.html",
"dijit/layout/TabContainer", "dijit/layout/ContentPane","dijit/layout/BorderContainer","dijit/form/TextBox", "dijit/layout/AccordionContainer"],
function(declare, dom, _Widget, _TemplatedMixin, template){
return declare("package.MainViewWidget", [_Widget, _TemplatedMixin], {
// widgetsInTemplate: true, /*keep this false, otherwise data-dojo-attach-event attribute is a pain in the ass!*/
templateString: template,
constructor: function(){
@prongs
prongs / .gitignore
Created December 27, 2012 13:39
android gitignore
# built application files
#*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
@prongs
prongs / MITM.py
Created November 14, 2012 12:50
Main in the middle attack
from scapy.all import *
import multiprocessing
import time,re
class MITM:
packets=[]
offset=0;
modifier='s'
diff_len=1
def __init__(self,victim=("192.168.56.129","00:0c:29:d1:aa:71" ),node2=("192.168.56.1", "00:50:56:c0:00:08")):
self.victim=victim
import re
from scapy.all import *
def psize(packet):
#assume 20 from http://stackoverflow.com/questions/6639799/calculate-size-and-start-of-tcp-packet-data-excluding-header
return packet[IP].len-packet[IP].ihl*4-4*packet[TCP].dataofs
def groupPacketsByFlow(packets):
flows={}
print flows
print type(packets)
3
3 3 0 1
0 1
1 2
0 2
4 5 0 3
0 1
1 3
0 2
2 3
// Ideone_Language_Id:1
/* Don"t remove the first line! */
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
// Ideone_Language_Id:1
/* Don"t remove the first line! */
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
// Ideone_Language_Id:1
/* Don"t remove the first line! */
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
def indent(in_stream,out_stream):
indent=0;
def split(line):
return list(x.strip() for x in line.split(';'))
def printsplit(line):
lines = split(line)
if len(lines)==1 and lines[0].strip()=='':
return
print lines
if lines[-1].strip()=='':
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
/*more #includes. Don't write "using namespace std" here*/
#ifdef __WIN32__
#define getchar_unlocked getchar