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 startClient(): | |
from ftplib import FTP | |
thread.start_new_thread(validation_server, (TCP_CON_PORT,)) | |
hostname = sys.argv[2] | |
ftp = FTP(hostname) | |
ftp.login() | |
filepath = sys.argv[3] | |
encFilepath = encrypt(filepath) | |
localfile = open(encFilepath,"rb") |
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 startServer(): | |
authorizer = DummyAuthorizer() | |
authorizer.add_anonymous(USER_HOME + "/anonymous", perm='elradfmwM') | |
handler = MyHandler | |
handler.authorizer = authorizer | |
handler.banner = "Server Ready.." | |
hostname = "" | |
address = (hostname,21) | |
server = FTPServer(address, handler) |
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 encrypt(filepath): | |
print "[!] Starting Encryption...." | |
aes_key = os.urandom(32) | |
out_filename = filepath + ".enc" | |
filehash = hashlib.md5(open(filepath).read()).hexdigest() | |
public_key_loc = PUB_KEY_LOC | |
pubkey = open(public_key_loc, "r").read() | |
rsakey = RSA.importKey(pubkey) |
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 decrypt(filepath): | |
print "[!] Starting decryption...." | |
dec_filename = ANONYMOUS_FILEPATH + os.path.basename(filepath).strip(".enc") | |
inFile = open(filepath,"r") | |
chunksize=64*1024 | |
hash = inFile.read(32) | |
encAESKey = inFile.read(512) | |
private_key_loc = PRIV_KEY_LOC | |
privkey = open(private_key_loc, "r").read() |
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 validateIntegrity(orighash, destfilepath): | |
desthash = hashlib.md5(open(destfilepath, "rb").read()).hexdigest() | |
if(orighash==desthash): | |
send_validation_result("1") | |
return True | |
else: | |
os.system("rm "+destfilepath) | |
send_validation_result("0") | |
return False |
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
#!/usr/bin/env python | |
import os, random, sys, hashlib, struct, thread, socket | |
from pyftpdlib.authorizers import DummyAuthorizer | |
from pyftpdlib.handlers import FTPHandler | |
from pyftpdlib.servers import FTPServer | |
from Crypto.Cipher import AES | |
from Crypto.PublicKey import RSA | |
from Crypto.Cipher import PKCS1_OAEP |
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
#! /usr/bin/python2 | |
import utils, hashlib, time, random | |
from math import ceil | |
class ElGamalSignature(object): | |
def __init__(self, p = None, x = None, g = None): | |
if p == None and x == None: |
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
eval("var number1 = 100"); | |
var number2 = 200; | |
var number3 = number1 + number2; | |
console.log(number3) |
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
> mystr | |
ReferenceError: mystr is not defined | |
at repl:1:1 | |
at REPLServer.defaultEval (repl.js:252:27) | |
at bound (domain.js:287:14) | |
at REPLServer.runBound [as eval] (domain.js:300:12) | |
at REPLServer.<anonymous> (repl.js:417:12) | |
at emitOne (events.js:82:20) | |
at REPLServer.emit (events.js:169:7) | |
at REPLServer.Interface._onLine (readline.js:210: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
var csrf = require('csurf'); | |
/*some code here*/ | |
var app = express(); | |
/*some code here*/ | |
app.use(csrf()); | |
app.get('/', function(req, res, next){ | |
res.render('index', { | |
_csrfToken = req.csrfToken(); | |
}); |
OlderNewer