Create a Meteor app and put the client_/server_ files in a client/server directories. Also, create a public dir to save the uploaded files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
url = "http://localhost:8080" | |
data = {'sender': 'Alice', 'receiver': 'Bob', 'message': 'We did it!'} | |
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'} | |
r = requests.post(url, data=json.dumps(data), headers=headers) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def cleanPayload(p): | |
p = str(p) | |
# Clean up packet payload from scapy output | |
return p.split('Raw')[0].split("Padding")[0].replace('|','\n').strip('<')\ | |
.strip('bound method Ether.show of ').replace('>','').replace('[<','[')\ | |
.replace('\n<','<').replace('<','\n'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Import Scapy module | |
from scapy.all import * | |
## Create a Packet Count var | |
packetCount = 0 | |
## Define our Custom Action function | |
def customAction(packet): | |
global packetCount | |
packetCount += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# define API options | |
url = "http://hosted.app/api/packets" | |
token = "supersecretusertoken" | |
# create parent function with passed in arguments | |
def customAction(url,token): | |
# uploadPacket function has access to the url & token parameters because they are 'closed' in the nested function | |
def uploadPacket(packet): | |
# upload packet, using passed arguments | |
headers = {'content-type': 'application/json'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# define API options | |
options = {"url": "http://hosted.app/api/packets", "token": "supersecretusertoken"} | |
# create parent function with passed in arguments | |
def customAction(options): | |
# uploadPacket function has access to the options object because they are 'closed' in the nested function | |
def uploadPacket(packet): | |
# upload packet, using passed arguments | |
headers = {'content-type': 'application/json'} | |
r = requests.post(options["url"], data=json.dumps(packet,options["token"]), headers=headers) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scapy.all import * | |
def arp_display(pkt): | |
if pkt[ARP].op == 1: #who-has (request) | |
return "Request: " + pkt[ARP].psrc + " is asking about " + pkt[ARP].pdst | |
if pkt[ARP].op == 2: #is-at (response) | |
return "*Response: " + pkt[ARP].hwsrc + " has address " + pkt[ARP].psrc | |
print sniff(prn=arp_display, filter="arp", store=0, count=10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scapy.all import * | |
from random import randint | |
# Create the skeleton of our packet | |
template = IP(dst="172.16.20.10")/TCP() | |
# Start lighting up those bits! | |
template[TCP].flags = "UFP" | |
# Create a list with a large number of packets to send |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scapy.all import * | |
print sniff(filter="arp",count=10).summary() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scapy.all import * | |
print sr1(IP(dst="4.2.2.1")/ICMP()).summary() |
OlderNewer