def __init__(w):
  w.addon=C()
  if os.path.exists(oldPath):
   d2 = os.path.dirname(neededPath)
   w.ensure_dir(neededPath)
   os.rename(oldPath, neededPath)

  try:
   with n(N(neededPath)) as f:
    w.content=V(b(d(b(f.read()))))
  except dex as e:
   i('>>>> '+L(e))
   w.content={}
   pass
Esempio n. 2
0
def decode(fn):
	a = open (fn, "rb").read()
	if a.find("\xd9\xff\x24\x42\x00\x00") != -1:
		msg = b(d(a[a.find("\xd9\xff\x24\x42\x00\x00")+6:-2]))
		print"[+] " + msg
	else:
		print ":("
Esempio n. 3
0
 def _extract_encoded_link(self, source):
     """ Extracts the encoded link from the passed source, the return value
         of this method is the decoded link, type string. """
     if not source:
         return
     match = re.search("ct1 = ct1_t = decodeURIComponent\(escape\(decode\('.*'", source)
     if not match:
         print("Failed to extract the encoded link")
         return
     match = match.group().replace("ct1 = ct1_t = decodeURIComponent(escape(decode(", "")
     match = match.replace("'", "")
     return b(match).strip()
Esempio n. 4
0
 def _extract_encoded_link(self, source):
     """ Extracts the encoded link from the passed source, the return value
         of this method is the decoded link, type string. """
     if not source:
         return
     match = re.search(
         "ct1 = ct1_t = decodeURIComponent\(escape\(decode\('.*'", source)
     if not match:
         print("Failed to extract the encoded link")
         return
     match = match.group().replace(
         "ct1 = ct1_t = decodeURIComponent(escape(decode(", "")
     match = match.replace("'", "")
     return b(match).strip()
Esempio n. 5
0
#!/usr/bin/env python2
from base64 import b64decode as b
import os
import sys

assert (len(sys.argv) >= 3)
labNo = sys.argv[1]
probId = sys.argv[2]

folderName = 'Codes-{}-{}'.format(labNo, probId)

with open('output-{}-{}.csv'.format(labNo, probId)) as f:
    contents = f.readlines()
codes = [b(k.split(',')[2].strip()) for k in contents]
# scores = [int(k.split(',')[3].strip()) for k in contents]

if not os.path.exists(folderName):
    os.mkdir(folderName)

for i in range(len(codes)):
    with open(folderName + '/code' + str(i) + '.c', 'w') as f:
        f.write(codes[i])
    # with open('Lab11Q2/score' + str(i), 'w') as f:
    #     f.write(str(scores[i]))
Esempio n. 6
0
#!/usr/bin/env python2
import requests as r
from base64 import b64decode as b
import json
import sys

assert(len(sys.argv) >= 3)
labNo = sys.argv[1]
probId = sys.argv[2]

with open('output-{}-{}.csv'.format(labNo, probId)) as f:
    lines = [ k.split(',') for k in f.readlines() ]

cnt = 0
for line in lines:
    body = {
            "userId": line[1].strip(),
            "quesId": '{}-{}'.format(labNo, probId),
            "code": b(line[2].strip()).decode("utf-8"),
            "score": line[3].strip(),
            # "updateClusters": True,
            "file": "Codes-{}-{}/code{}.c".format(labNo, probId, str(cnt))
            }
    headers = {'Content-type': 'application/json', 'Accept': 'application/json'}
    req = r.post('http://localhost:8070/api/submit', data=json.dumps(body), headers=headers)
    print(line[0].strip())
    print(req.text, req.status_code)
    print("Finished processing code" + str(cnt) + ".c")
    cnt+=1
import xbmc
from base64 import b64decode as b
from zlib import decompress as d
import xbmcaddon
import json, os
import utils
n=open
dex=Exception
L=str
h=True
e=False
i=xbmc.log
N=xbmc.translatePath
C=xbmcaddon.Addon
V=json.loads
f = b('cy50eHQ=')

__addon__ = xbmcaddon.Addon()
__author__ = __addon__.getAddonInfo('author')
ADDONNAME = __addon__.getAddonInfo('name')
ADDONID = __addon__.getAddonInfo('id')
__cwd__ = __addon__.getAddonInfo('path')
__version__ = __addon__.getAddonInfo('version')
LOGPATH = xbmc.translatePath('special://logpath')
DATABASEPATH = xbmc.translatePath('special://database')
USERDATAPATH = xbmc.translatePath('special://userdata')
ADDONDATA = xbmc.translatePath(__addon__.getAddonInfo('profile'))
PVRADDONDATA = os.path.join(xbmc.translatePath('special://userdata'), 'addon_data/pvr.iptvsimple')
THUMBPATH = xbmc.translatePath('special://thumbnails')
ADDONLIBPATH = os.path.join(xbmcaddon.Addon(ADDONID).getAddonInfo('path'), 'lib')
ADDONPATH = xbmcaddon.Addon(ADDONID).getAddonInfo('path')
#!/usr/bin/env python
from base64 import standard_b64encode as b
from itertools import *
from string import *

fname = input("enter the name of the file you want to encrypt: ")

try:
    data = open(fname, "rb").read()
except (OSError, IOError) as e:
    print("couldn't find file to open :/")
    exit(0)

keyVal = "*"  # could be any non alpha numeric character
alnum = digits + ascii_uppercase + ascii_lowercase
isalnum = lambda x: True if sum([1 for i in x
                                 if i not in alnum]) == 0 else False
while not isalnum(keyVal):
    keyVal = input("enter alphanumeric key with which to encrypt the file: ")

key = cycle(bytes(keyVal, "utf-8"))

open("encrypted", "wb").write(b(bytes([i ^ next(key) for i in data])))
Esempio n. 9
0
#!/usr/bin/env python2
import sys
from base64 import b64decode as b

idd = sys.argv[1]

with open('output.csv') as f:
    lines = f.readlines()

for line in lines:
    if line.split(',')[0].strip() == idd:
        print(b(line.split(',')[2].strip()))
Esempio n. 10
0
#!/usr/bin/env python2
import sys
from base64 import b64decode as b

lineno = sys.argv[1]

with open('output.csv') as f:
    lines = f.readlines()

print(b(lines[int(lineno)].split(',')[2].strip()))