Ejemplo n.º 1
0
    def _fill(self, wtd):
        #
        # Obfuscated code ahead. We keep at least one byte in the pre_buffer,
        # so we don't stumble over an orphaned RUNCHAR later on. If the
        # last or second-last char is a RUNCHAR we keep more bytes.
        #
        self.pre_buffer = self.pre_buffer + self.ifp.read(wtd + 2)
        if self.ifp.eof:
            self.post_buffer = self.post_buffer + \
             binascii.rledecode_hqx(self.pre_buffer)
            self.pre_buffer = ''
            return

        lastrle = string.rfind(self.pre_buffer, RUNCHAR)
        if lastrle > 0 and lastrle == len(self.pre_buffer) - 1:
            # Last byte is an RLE, keep two bytes
            mark = len(self.pre_buffer) - 2
        elif lastrle > 0 and lastrle == len(self.pre_buffer) - 2:
            # second-last byte is an RLE. Decode all.
            mark = len(self.pre_buffer)
        else:
            mark = len(self.pre_buffer) - 1
        self.post_buffer = self.post_buffer + \
         binascii.rledecode_hqx(self.pre_buffer[:mark])
        self.pre_buffer = self.pre_buffer[mark:]
Ejemplo n.º 2
0
    def _fill(self, wtd):
        self.pre_buffer = self.pre_buffer + self.ifp.read(wtd + 4)
        if self.ifp.eof:
            self.post_buffer = self.post_buffer + binascii.rledecode_hqx(self.pre_buffer)
            self.pre_buffer = b""
            return

        #
        # Obfuscated code ahead. We have to take care that we don't
        # end up with an orphaned RUNCHAR later on. So, we keep a couple
        # of bytes in the buffer, depending on what the end of
        # the buffer looks like:
        # '\220\0\220' - Keep 3 bytes: repeated \220 (escaped as \220\0)
        # '?\220' - Keep 2 bytes: repeated something-else
        # '\220\0' - Escaped \220: Keep 2 bytes.
        # '?\220?' - Complete repeat sequence: decode all
        # otherwise: keep 1 byte.
        #
        mark = len(self.pre_buffer)
        if self.pre_buffer[-3:] == RUNCHAR + b"\0" + RUNCHAR:
            mark = mark - 3
        elif self.pre_buffer[-1:] == RUNCHAR:
            mark = mark - 2
        elif self.pre_buffer[-2:] == RUNCHAR + b"\0":
            mark = mark - 2
        elif self.pre_buffer[-2:-1] == RUNCHAR:
            pass  # Decode all
        else:
            mark = mark - 1

        self.post_buffer = self.post_buffer + binascii.rledecode_hqx(self.pre_buffer[:mark])
        self.pre_buffer = self.pre_buffer[mark:]
Ejemplo n.º 3
0
    def _fill(self, wtd):
        self.pre_buffer = self.pre_buffer + self.ifp.read(wtd + 4)
        if self.ifp.eof:
            self.post_buffer = self.post_buffer + \
                binascii.rledecode_hqx(self.pre_buffer)
            self.pre_buffer = ''
            return

        #
        # Obfuscated code ahead. We have to take care that we don't
        # end up with an orphaned RUNCHAR later on. So, we keep a couple
        # of bytes in the buffer, depending on what the end of
        # the buffer looks like:
        # '\220\0\220' - Keep 3 bytes: repeated \220 (escaped as \220\0)
        # '?\220' - Keep 2 bytes: repeated something-else
        # '\220\0' - Escaped \220: Keep 2 bytes.
        # '?\220?' - Complete repeat sequence: decode all
        # otherwise: keep 1 byte.
        #
        mark = len(self.pre_buffer)
        if self.pre_buffer[-3:] == RUNCHAR + '\0' + RUNCHAR:
            mark = mark - 3
        elif self.pre_buffer[-1] == RUNCHAR:
            mark = mark - 2
        elif self.pre_buffer[-2:] == RUNCHAR + '\0':
            mark = mark - 2
        elif self.pre_buffer[-2] == RUNCHAR:
            pass  # Decode all
        else:
            mark = mark - 1

        self.post_buffer = self.post_buffer + \
            binascii.rledecode_hqx(self.pre_buffer[:mark])
        self.pre_buffer = self.pre_buffer[mark:]
Ejemplo n.º 4
0
	def _fill(self, wtd):
		#
		# Obfuscated code ahead. We keep at least one byte in the pre_buffer,
		# so we don't stumble over an orphaned RUNCHAR later on. If the
		# last or second-last char is a RUNCHAR we keep more bytes.
		#
		self.pre_buffer = self.pre_buffer + self.ifp.read(wtd+2)
		if self.ifp.eof:
			self.post_buffer = self.post_buffer + \
				binascii.rledecode_hqx(self.pre_buffer)
			self.pre_buffer = ''
			return
			
		lastrle = string.rfind(self.pre_buffer, RUNCHAR)
		if lastrle > 0 and lastrle == len(self.pre_buffer)-1:
			# Last byte is an RLE, keep two bytes
			mark = len(self.pre_buffer)-2
		elif lastrle > 0 and lastrle == len(self.pre_buffer)-2:
			# second-last byte is an RLE. Decode all.
			mark = len(self.pre_buffer)
		else:
			mark = len(self.pre_buffer)-1
		self.post_buffer = self.post_buffer + \
			binascii.rledecode_hqx(self.pre_buffer[:mark])
		self.pre_buffer = self.pre_buffer[mark:]
Ejemplo n.º 5
0
def _load_logo():
    _ds9_python_logo_text = r"""8dP08%a&)#!p)*!89##3-N**9&"*@#!J25#3&$JJN$*139K*8b!J)$dJN"3b)*!b6N&B59-a)#!p)*!5-cFi)*!b6N&B59-b)#!p)*!5-6B`)*!b3PT&8NmJ)#!p)*!0-#i`N!BJN$*#8d0"6%8J)$dJN!da,M#3"L#3-N4"9%&058iJ25#3$6!Z-*!')*!b4%&838e"@#!p)*!,-M8e,M#3"L#3JNK*8e428PNJ9%K*8b"'5946)%C*6%8J9d&6)%G&6N95394&4#"#@5"(58e3)&9658j()%C*9&059b#3Cd0268e&6P3J4QPdFe*A)'Pc)#K$+5"3CA4PFL",DA*MD'GPFh0ZCA)J+("PG'9b3'YTFQ0SCf9cFfjPFLjZCA3T,#"LGA3JBACKD@aKBQaP3dp068919#"eEQ4PFL"dD'8J4dj9)'GPEQ9bB@`JF(9LE'PM)'aTBf9ZBf8Z)*!M3dp068919#"'Eh)JFfpeFQ0PFb"cC@8JD(4dF$S[,hGhGbjVDA*MD'GPFh0ZCA)ZEQ9d)*"Y3dp068919#"*E@&RC5"dHA"P)(GTG'KTEL"(58e31L"(58e3Ae*(3Pp*68&(45#3)N0268e&6P3J8f9aG@9ZBf8JCQpb)%j"@%P6-b!J)$SJ8N9%,#"(8N9&6L`J3Na945#3F%914##3rb#3rb#3rb#3rb#3rb#38[q3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq30raj-B[krj$rrj"fq8dq9l,rN2rrN(INkZaRmIq3&IMSrj!4k2[rN!Iilqk3#1hmrj$rrj!mC-[rN"A3@Iq3$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.rledecode_hqx(_ds9_python_logo)
Ejemplo n.º 6
0
    def test_hqx(self):
        # Perform binhex4 style RLE-compression
        # Then calculate the hexbin4 binary-to-ASCII translation
        rle = binascii.rlecode_hqx(self.data)
        a = binascii.b2a_hqx(self.type2test(rle))

        b, _ = binascii.a2b_hqx(self.type2test(a))
        res = binascii.rledecode_hqx(b)
        self.assertEqual(res, self.rawdata)
Ejemplo n.º 7
0
    def test_hqx(self):
        # Perform binhex4 style RLE-compression
        # Then calculate the hexbin4 binary-to-ASCII translation
        rle = binascii.rlecode_hqx(self.data)
        a = binascii.b2a_hqx(self.type2test(rle))

        b, _ = binascii.a2b_hqx(self.type2test(a))
        res = binascii.rledecode_hqx(b)
        self.assertEqual(res, self.rawdata)
Ejemplo n.º 8
0
 def test_not_implemented(self):
     test_cases = [
         lambda: binascii.a2b_hqx(None),
         lambda: binascii.rledecode_hqx(None),
         lambda: binascii.rlecode_hqx(None),
         lambda: binascii.b2a_hqx(None),
     ]
     for temp_func in test_cases:
         self.assertRaises(NotImplementedError, temp_func)
Ejemplo n.º 9
0
 def _fill(self, wtd):
     self.pre_buffer = self.pre_buffer + self.ifp.read(wtd + 4)
     if self.ifp.eof:
         self.post_buffer = self.post_buffer + binascii.rledecode_hqx(self.pre_buffer)
         self.pre_buffer = ''
         return
     mark = len(self.pre_buffer)
     if self.pre_buffer[-3:] == RUNCHAR + '\x00' + RUNCHAR:
         mark = mark - 3
     elif self.pre_buffer[-1] == RUNCHAR:
         mark = mark - 2
     elif self.pre_buffer[-2:] == RUNCHAR + '\x00':
         mark = mark - 2
     elif self.pre_buffer[-2] == RUNCHAR:
         pass
     else:
         mark = mark - 1
     self.post_buffer = self.post_buffer + binascii.rledecode_hqx(self.pre_buffer[:mark])
     self.pre_buffer = self.pre_buffer[mark:]
Ejemplo n.º 10
0
 def _fill(self, wtd):
     self.pre_buffer = self.pre_buffer + self.ifp.read(wtd + 4)
     if self.ifp.eof:
         self.post_buffer = self.post_buffer + binascii.rledecode_hqx(self.pre_buffer)
         self.pre_buffer = ''
         return
     mark = len(self.pre_buffer)
     if self.pre_buffer[-3:] == RUNCHAR + '\x00' + RUNCHAR:
         mark = mark - 3
     elif self.pre_buffer[-1] == RUNCHAR:
         mark = mark - 2
     elif self.pre_buffer[-2:] == RUNCHAR + '\x00':
         mark = mark - 2
     elif self.pre_buffer[-2] == RUNCHAR:
         pass
     else:
         mark = mark - 1
     self.post_buffer = self.post_buffer + binascii.rledecode_hqx(self.pre_buffer[:mark])
     self.pre_buffer = self.pre_buffer[mark:]
    def test_deprecated_warnings(self):
        with self.assertWarns(DeprecationWarning):
            self.assertEqual(binascii.b2a_hqx(b'abc'), b'B@*M')
        with self.assertWarns(DeprecationWarning):
            self.assertEqual(binascii.a2b_hqx(b'B@*M'), (b'abc', 0))

        with self.assertWarns(DeprecationWarning):
            self.assertEqual(binascii.rlecode_hqx(b'a' * 10), b'a\x90\n')

        with self.assertWarns(DeprecationWarning):
            self.assertEqual(binascii.rledecode_hqx(b'a\x90\n'), b'a' * 10)
Ejemplo n.º 12
0
    def test_hqx(self):
        # Perform binhex4 style RLE-compression
        # Then calculate the hexbin4 binary-to-ASCII translation
        if test_support.due_to_ironpython_bug("http://ironpython.codeplex.com/workitem/28171"):
            return
        rle = binascii.rlecode_hqx(self.data)
        a = binascii.b2a_hqx(self.type2test(rle))
        b, _ = binascii.a2b_hqx(self.type2test(a))
        res = binascii.rledecode_hqx(b)

        self.assertEqual(res, self.rawdata)
Ejemplo n.º 13
0
    def test_hqx(self):
        # Perform binhex4 style RLE-compression
        # Then calculate the hexbin4 binary-to-ASCII translation
        if test_support.due_to_ironpython_bug(
                "http://ironpython.codeplex.com/workitem/28171"):
            return
        rle = binascii.rlecode_hqx(self.data)
        a = binascii.b2a_hqx(self.type2test(rle))
        b, _ = binascii.a2b_hqx(self.type2test(a))
        res = binascii.rledecode_hqx(b)

        self.assertEqual(res, self.rawdata)
Ejemplo n.º 14
0
def test_not_implemented():
    test_cases = [
        lambda: binascii.a2b_qp(None),
        lambda: binascii.a2b_qp(None, None),
        lambda: binascii.a2b_hqx(None),
        lambda: binascii.rledecode_hqx(None),
        lambda: binascii.rlecode_hqx(None),
        lambda: binascii.b2a_hqx(None),
        lambda: binascii.crc_hqx(None, None),
    ]
    for temp_func in test_cases:
        AssertError(NotImplementedError, temp_func)
Ejemplo n.º 15
0
 def test_not_implemented(self):
     test_cases = [
                     lambda: binascii.a2b_qp(None),
                     lambda: binascii.a2b_qp(None, None),
                     lambda: binascii.a2b_hqx(None),
                     lambda: binascii.rledecode_hqx(None),
                     lambda: binascii.rlecode_hqx(None),
                     lambda: binascii.b2a_hqx(None),
                     lambda: binascii.crc_hqx(None, None),
                     ]
     for temp_func in test_cases:
         self.assertRaises(NotImplementedError, temp_func)
Ejemplo n.º 16
0
    def test_rle(self):
        # test repetition with a repetition longer than the limit of 255
        data = (b'a' * 100 + b'b' + b'c' * 300)

        encoded = binascii.rlecode_hqx(data)
        self.assertEqual(encoded,
                         (b'a\x90d'      # 'a' * 100
                          b'b'           # 'b'
                          b'c\x90\xff'   # 'c' * 255
                          b'c\x90-'))    # 'c' * 45

        decoded = binascii.rledecode_hqx(encoded)
        self.assertEqual(decoded, data)
Ejemplo n.º 17
0
    def test_rle(self):
        # test repetition with a repetition longer than the limit of 255
        data = (b'a' * 100 + b'b' + b'c' * 300)

        encoded = binascii.rlecode_hqx(data)
        self.assertEqual(encoded,
                         (b'a\x90d'      # 'a' * 100
                          b'b'           # 'b'
                          b'c\x90\xff'   # 'c' * 255
                          b'c\x90-'))    # 'c' * 45

        decoded = binascii.rledecode_hqx(encoded)
        self.assertEqual(decoded, data)
Ejemplo n.º 18
0
def recv_callback(msg):
    t = time.time()
    # print '\nReceived '+ str(t) + ': '  + str(msg.application_headers)
    # print '\t' + str(msg.body) + '\n'
    headers = msg.application_headers
    print("#################################\n")
    print("Received " + str(t) + ": " + str(headers["name"]))
    print(headers["time"])
    (type, pkt) = unstuffPkt(headers["name"], float(headers["time"]), msg.body,
                             int(headers["nbytes"]))
    print("srcname: " + str(pkt.srcname()) + "\n")
    print("time: " + str(pkt.time()) + "\n")
    print("PktType: " + str(pkt.PacketType()) + "\n")
    print("type: " + str(pkt.type()) + "\n")
    print("nchannels: " + str(pkt.nchannels()) + "\n")
    print("pf: " + str(pkt.pf()) + "\n")
    print("string: " + str(pkt.string()) + "\n")
    print("db: " + str(pkt.db()) + "\n")
    print("dfile: " + str(pkt.dfile()) + "\n")
    print("version: " + str(pkt.version()) + "\n")

    pktchannel = pkt.channels(0)

    print("time: " + str(pktchannel.time()) + "\n")
    print("net: " + str(pktchannel.net()) + "\n")
    print("sta: " + str(pktchannel.sta()) + "\n")
    print("chan: " + str(pktchannel.chan()) + "\n")
    print("loc: " + str(pktchannel.loc()) + "\n")
    print("nsamp: " + str(pktchannel.nsamp()) + "\n")
    print("samprate: " + str(pktchannel.samprate()) + "\n")
    print("data: " + str(pktchannel.data()) + "\n")
    print("calib: " + str(pktchannel.calib()) + "\n")
    print("calper: " + str(pktchannel.calper()) + "\n")
    print("segtype: " + str(pktchannel.segtype()) + "\n")

    print("##")
    print("## Start binascii test")
    print("##")
    rle = binascii.rledecode_hqx(msg.body)
    print(rle)
    print("##")
    print("##")
Ejemplo n.º 19
0
def recv_callback(msg):
    t = time.time()
    #print '\nReceived '+ str(t) + ': '  + str(msg.application_headers)
    #print '\t' + str(msg.body) + '\n'
    headers = msg.application_headers
    print '#################################\n'
    print 'Received '+ str(t) + ': '  + str(headers['name'])
    print headers['time']
    (type,pkt) = unstuffPkt( headers['name'], float(headers['time']), msg.body, int(headers['nbytes']) )
    print 'srcname: ' + str(pkt.srcname()) + '\n'
    print 'time: ' + str(pkt.time()) + '\n'
    print 'PktType: ' + str(pkt.PacketType()) + '\n'
    print 'type: ' + str(pkt.type()) + '\n'
    print 'nchannels: ' + str(pkt.nchannels()) + '\n'
    print 'pf: ' + str(pkt.pf()) + '\n'
    print 'string: ' + str(pkt.string()) + '\n'
    print 'db: ' + str(pkt.db()) + '\n'
    print 'dfile: ' + str(pkt.dfile()) + '\n'
    print 'version: ' + str(pkt.version()) + '\n'

    pktchannel = pkt.channels(0)

    print 'time: ' + str(pktchannel.time()) + '\n'
    print 'net: ' + str(pktchannel.net()) + '\n'
    print 'sta: ' + str(pktchannel.sta()) + '\n'
    print 'chan: ' + str(pktchannel.chan()) + '\n'
    print 'loc: ' + str(pktchannel.loc()) + '\n'
    print 'nsamp: ' + str(pktchannel.nsamp()) + '\n'
    print 'samprate: ' + str(pktchannel.samprate()) + '\n'
    print 'data: ' + str(pktchannel.data()) + '\n'
    print 'calib: ' + str(pktchannel.calib()) + '\n'
    print 'calper: ' + str(pktchannel.calper()) + '\n'
    print 'segtype: ' + str(pktchannel.segtype()) + '\n'

    print '##'
    print '## Start binascii test'
    print '##'
    rle = binascii.rledecode_hqx(msg.body)
    print rle
    print '##'
    print '##'
Ejemplo n.º 20
0
a2b = binascii.a2b_hex(b2a)
print repr(a2b)

b2a = binascii.b2a_hqx(str)
print repr(b2a)
a2b,done = binascii.a2b_hqx(b2a) # returns a string instead of a tuple
print repr(a2b),done

b2a = binascii.b2a_base64(str)
print repr(b2a)
a2b = binascii.a2b_base64(b2a)
print repr(a2b)

b2a = binascii.rlecode_hqx(str)
print repr(b2a)
a2b = binascii.rledecode_hqx(b2a)
print repr(a2b)

b2a = binascii.hexlify(str)
print repr(b2a)
a2b = binascii.unhexlify(b2a)
print repr(a2b)

# delslice bug
all = range(10)
print all[2:8:2]
all[1:3] = range(5)
print all
del all[1:7:2]
print all
Ejemplo n.º 21
0
def decode_file(data_input, nome_arq):
	dataoutput = binascii.rledecode_hqx(output_file(data_input, nome_arq))
 	return str(dataoutput)
Ejemplo n.º 22
0
 def test_hqx(self):
     rle = binascii.rlecode_hqx(self.data)
     a = binascii.b2a_hqx(self.type2test(rle))
     b, _ = binascii.a2b_hqx(self.type2test(a))
     res = binascii.rledecode_hqx(b)
     self.assertEqual(res, self.rawdata)
Ejemplo n.º 23
0
 def test_rle(self):
     data = b'a' * 100 + b'b' + b'c' * 300
     encoded = binascii.rlecode_hqx(data)
     self.assertEqual(encoded, b'a\x90dbc\x90\xffc\x90-')
     decoded = binascii.rledecode_hqx(encoded)
     self.assertEqual(decoded, data)
Ejemplo n.º 24
0
"""Macintosh binhex compression/decompression.
Ejemplo n.º 25
0
#!/usr/bin/python
import socket
import binascii


def input_file(nome_arq):
  with open(nome_arq, "rb") as f:
    byte = f.read()
  return byte

def output_file(out_info, out_name):
  nome_cypt = str(out_name[0:-3]) + "dec"
  arq_out = open(nome_cypt, "wb+")
  arq_out.write(out_info)
  arq_out.close()


datainput = binascii.rlecode_hqx(input_file('FF.txt'))

#print(datainput)

output_file( datainput, 'FF.txt')

dataoutput = binascii.rledecode_hqx(datainput)

output_file(dataoutput, "FFO.txt")

#print(dataoutput)
Ejemplo n.º 26
0
def decode_file(nome_arq):
	dataoutput = binascii.rledecode_hqx(output_file(nome_arq))
	return dataoutput
Ejemplo n.º 27
0
    def thg_encode(self, args):
        """modulo referente a encode de estrings"""
        arg_mensage = args.split(" ")
        if arg_mensage[0] == "":
            print("""suporte encode:

Este módulo fornece funções para codificar dados binários em caracteres ASCII 
imprimíveis e decodificar essas codificações de volta para dados binários.
Ele fornece funções de codificação e decodificação para as codificações 
especificadas em RFC 3548 ,que define os algoritmos Base16, Base32 e Base64,
e para as codificações Ascii85 e Base85 padrão de fato.

a2b_uu
b2a_uu
a2b_base64
b2a_base64
a2b_qp
b2a_qp
a2b_hqx
rledecode_hqx
rlecode_hqx
b2a_hqx
crc_hqx
crc32
b2a_hex
a2b_hex
hexlify
unhexlify
Charcode
binary
base62
basen
bcd
ur
unicode_normalize
qp_encoding
        encode type[2,16,32,64]  str
        
        """.format(YELLOW=Fore.YELLOW, BLUE=Fore.BLUE, RED=Fore.RED))

        elif arg_mensage[0] == "64":
            arg_mensage[1] = arg_mensage[1].encode('ascii')
            base64_bytes = base64.b64encode(arg_mensage[1])
            by_to_st(base64_bytes)
        elif arg_mensage[0] == "32":
            arg_mensage[1] = arg_mensage[1].encode('ascii')
            b32encode_bytes = base64.b32encode(arg_mensage[1])
            by_to_st(b32encode_bytes)
        elif arg_mensage[0] == "16":
            arg_mensage[1] = arg_mensage[1].encode('ascii')
            b16encode_bytes = base64.b16encode(arg_mensage[1])
            by_to_st(b16encode_bytes)
        elif arg_mensage[0] == "a85encode":
            arg_mensage[1] = arg_mensage[1].encode('ascii')
            a85encode_bytes = base64.a85encode(arg_mensage[1])
            by_to_st(a85encode_bytes)
        elif arg_mensage[0] == "b85encode":
            arg_mensage[1] = arg_mensage[1].encode('ascii')
            b85encode_bytes = base64.b85encode(arg_mensage[1])
            by_to_st(b85encode_bytes)
        elif arg_mensage[0] == "a2b_uu":
            if arg_mensage[1] == "help":
                print(
                    """{YELLOW}a2b_uu{YELLOW}{BLUE} =>{BLUE}{RED} Converta uma única linha de dados uuencodificados de volta em binários e retorne os dados binários. As linhas normalmente contêm 45 bytes (binários), exceto a última linha. Os dados da linha podem ser seguidos de espaços em branco."""
                    .format(YELLOW=Fore.YELLOW, BLUE=Fore.BLUE, RED=Fore.RED))
            else:
                by_to_st((binascii.a2b_uu(arg_mensage[1])))
        elif arg_mensage[0] == "a2b_base64":
            if arg_mensage[1] == "help":
                print(
                    """{YELLOW}a2b_uu{YELLOW}{BLUE} =>{BLUE}{RED}Converta dados binários em uma linha de caracteres ASCII na codificação base64. O valor de retorno é a linha convertida, incluindo um caractere de nova linha. O comprimento dos dados deve ser de no máximo 57 para aderir ao padrão base64."""
                    .format(YELLOW=Fore.YELLOW, BLUE=Fore.BLUE, RED=Fore.RED))
            else:
                by_to_st(binascii.a2b_base64(arg_mensage[1]))
        elif arg_mensage[0] == "b2a_base64":
            if arg_mensage[1] == "help":
                print(
                    """{YELLOW}a2b_uu{YELLOW}{BLUE} =>{BLUE}{RED} Converta dados binários em uma linha de caracteres ASCII na codificação base64. O valor de retorno é a linha convertida, incluindo um caractere de nova linha. O comprimento dos dados deve ser de no máximo 57 para aderir ao padrão base64."""
                    .format(YELLOW=Fore.YELLOW, BLUE=Fore.BLUE, RED=Fore.RED))
            else:
                by_to_st(binascii.b2a_base64(b'arg_mensage[1]'))
        elif arg_mensage[0] == "a2b_qp":
            if arg_mensage[1] == "help":
                print(
                    """{YELLOW}a2b_uu{YELLOW}{BLUE} =>{BLUE}{RED}Converta um bloco de dados imprimíveis entre aspas de volta em binários e retorne os dados binários. Mais de uma linha pode ser passada por vez. Se o cabeçalho do argumento opcional estiver presente e verdadeiro, os sublinhados serão decodificados como espaços."""
                    .format(YELLOW=Fore.YELLOW, BLUE=Fore.BLUE, RED=Fore.RED))
            else:
                by_to_st(binascii.a2b_qp(arg_mensage[1]))
        elif arg_mensage[0] == "b2a_qp":
            if arg_mensage[1] == "help":
                print(
                    """{YELLOW}a2b_uu{YELLOW}{BLUE} =>{BLUE}{RED}Converta dados binários em uma (s) linha (s) de caracteres ASCII em codificação imprimível entre aspas. O valor de retorno é a (s) linha (s) convertida (s). Se o argumento opcional quotetabs estiver presente e verdadeiro, todas as tabulações e espaços serão codificados. Se o argumento opcional istext estiver presente e verdadeiro, as novas linhas não serão codificadas, mas os espaços em branco finais serão codificados. Se o cabeçalho do argumento opcional estiver presente e verdadeiro, os espaços serão codificados como sublinhados de acordo com RFC1522. Se o cabeçalho do argumento opcional estiver presente e for falso, os caracteres de nova linha também serão codificados; caso contrário, a conversão de alimentação de linha pode corromper o fluxo de dados binários."""
                    .format(YELLOW=Fore.YELLOW, BLUE=Fore.BLUE, RED=Fore.RED))
            else:
                by_to_st(binascii.a2b_qp(arg_mensage[1].encode()))
        elif arg_mensage[0] == "a2b_hqx":
            if arg_mensage[1] == "help":
                print(
                    """{YELLOW}a2b_uu{YELLOW}{BLUE} =>{BLUE}{RED}Converta dados ASCII formatados de binhex4 em binários, sem fazer a descompressão RLE. A string deve conter um número completo de bytes binários ou (no caso da última parte dos dados binhex4) ter os bits restantes zero.
""".format(YELLOW=Fore.YELLOW, BLUE=Fore.BLUE, RED=Fore.RED))
            else:
                by_to_st(binascii.a2b_hqx(arg_mensage[1]))
        elif arg_mensage[0] == "rledecode_hqx":
            if arg_mensage[1] == "help":
                print(
                    """{YELLOW}a2b_uu{YELLOW}{BLUE} =>{BLUE}{RED} Execute a descompressão RLE nos dados, de acordo com o padrão binhex4. O algoritmo usa 0x90 após um byte como um indicador de repetição, seguido por uma contagem. Uma contagem de 0 especifica um valor de byte de 0x90 . A rotina retorna os dados descompactados, a menos que os dados de entrada de dados terminem em um indicador de repetição órfão, caso em que a exceção Incompleta é levantada."""
                    .format(YELLOW=Fore.YELLOW, BLUE=Fore.BLUE, RED=Fore.RED))
            else:
                by_to_st((binascii.rledecode_hqx(arg_mensage[1].encode())))
        elif arg_mensage[0] == "rlecode_hqx":
            if arg_mensage[1] == "help":
                print(
                    """{YELLOW}a2b_uu{YELLOW}{BLUE} =>{BLUE}{RED} Execute a compactação RLE no estilo binhex4 nos dados e retorne o resultado."""
                    .format(YELLOW=Fore.YELLOW, BLUE=Fore.BLUE, RED=Fore.RED))
            else:
                by_to_st((binascii.rlecode_hqx(arg_mensage[1].encode())))
        elif arg_mensage[0] == "b2a_hqx":
            if arg_mensage[1] == "help":
                print(
                    """{YELLOW}a2b_uu{YELLOW}{BLUE} =>{BLUE}{RED} Execute a conversão hexbin4 binário para ASCII e retorne a string resultante. O argumento já deve ser codificado por RLE e ter um comprimento divisível por 3 (exceto possivelmente o último fragmento).
""".format(YELLOW=Fore.YELLOW, BLUE=Fore.BLUE, RED=Fore.RED))
            else:
                by_to_st((binascii.b2a_hqx(arg_mensage[1].encode())))
        elif arg_mensage[0] == "crc_hqx":
            if arg_mensage[1] == "help":
                print(
                    """{YELLOW}a2b_uu{YELLOW}{BLUE} =>{BLUE}{RED} Calcule o valor binhex4 crc dos dados , começando com um crc inicial e retornando o resultado.
""".format(YELLOW=Fore.YELLOW, BLUE=Fore.BLUE, RED=Fore.RED))
            else:
                by_to_st((binascii.crc_hqx(arg_mensage[1].encode(),
                                           int(arg_mensage[2]))))
        elif arg_mensage[0] == "crc32":
            if arg_mensage[1] == "help":
                print(
                    """{YELLOW}a2b_uu{YELLOW}{BLUE} =>{BLUE}{RED} Calcule CRC-32, a soma de verificação de dados de 
                32 bits, começando com um crc inicial. Isso é consistente com a soma de verificação do arquivo ZIP. 
                Uma vez que o algoritmo é projetado para uso como um algoritmo de soma de verificação, não é adequado 
                para uso como um algoritmo de hash geral. 

{YELLOW}Nota{YELLOW}{RED} Para gerar o mesmo valor numérico em todas as versões e plataformas Python, {RED}{BLUE}use crc32 (dados) & 0xffffffff{BLUE}{RED}. Se você estiver usando apenas a soma de verificação no formato binário compactado, isso não é necessário, pois o valor de retorno é a representação binária correta de 32 bits, independentemente do sinal.
        """.format(YELLOW=Fore.YELLOW, BLUE=Fore.BLUE, RED=Fore.RED))
            else:
                by_to_st((binascii.crc32(arg_mensage[1].encode())))
        elif arg_mensage[0] == "hexlify":
            if arg_mensage[1] == "help":
                print(
                    """{YELLOW}a2b_uu{YELLOW}{BLUE} =>{BLUE}{RED} Retorna a representação hexadecimal dos dados 
                binários . Cada byte de dados é convertido na representação hexadecimal de 2 dígitos correspondente. 
                A string resultante é, portanto, o dobro do comprimento dos dados . 

        """.format(YELLOW=Fore.YELLOW, BLUE=Fore.BLUE, RED=Fore.RED))
            else:
                by_to_st((binascii.hexlify(arg_mensage[1].encode(),
                                           arg_mensage[2].encode())))
        elif arg_mensage[0] == "b2a_hex":
            if arg_mensage[1] == "help":
                print("""{YELLOW}a2b_uu{YELLOW}{BLUE} =>{BLUE}{RED} hex
        """.format(YELLOW=Fore.YELLOW, BLUE=Fore.BLUE, RED=Fore.RED))
            else:
                by_to_st((binascii.b2a_hex(arg_mensage[1].encode(),
                                           int(arg_mensage[2]))))
        elif arg_mensage[0] == "unhexlify":
            if arg_mensage[1] == "help":
                print(
                    """{YELLOW}a2b_uu{YELLOW}{BLUE} =>{BLUE}{RED} Retorna os dados binários representados pela string hexadecimal hexstr . Esta função é o inverso de b2a_hex () . hexstr deve conter um número par de dígitos hexadecimais (que podem ser maiúsculas ou minúsculas), caso contrário, um TypeError é gerado.

        """.format(YELLOW=Fore.YELLOW, BLUE=Fore.BLUE, RED=Fore.RED))
            else:
                by_to_st((binascii.unhexlify(arg_mensage[1].encode())))
        elif arg_mensage[0] == "b2a_uu":
            if arg_mensage[1] == "help":
                print(
                    """{YELLOW}a2b_uu{YELLOW}{BLUE} =>{BLUE}{RED} Converta dados binários em uma linha de caracteres ASCII, o valor de retorno é a linha convertida, incluindo um caractere de nova linha. O comprimento dos dados deve ser de no máximo 45.

        """.format(YELLOW=Fore.YELLOW, BLUE=Fore.BLUE, RED=Fore.RED))
            else:
                by_to_st((binascii.b2a_uu(arg_mensage[1].encode(),
                                          int(arg_mensage[2]))))
        elif arg_mensage[0] == "charcode":
            if arg_mensage[1] == "help":
                print(
                    """{YELLOW}charcode{YELLOW}{BLUE} =>{BLUE}{RED}converte string em charcode
        """.format(YELLOW=Fore.YELLOW, BLUE=Fore.BLUE, RED=Fore.RED))
            else:
                print(ord(arg_mensage[1].encode()))
        elif arg_mensage[0] == "binary":
            if arg_mensage[1] == "help":
                print(
                    """{YELLOW}binary{YELLOW}{BLUE} =>{BLUE}{RED}converte string em binary
        """.format(YELLOW=Fore.YELLOW, BLUE=Fore.BLUE, RED=Fore.RED))
            else:
                print(' '.join(format(ord(x), 'b') for x in arg_mensage[1]))
        elif arg_mensage[0] == "base62":
            if arg_mensage[1] == "help":
                print(
                    """{YELLOW}base62{YELLOW}{BLUE} =>{BLUE}{RED}converte string em base62
        """.format(YELLOW=Fore.YELLOW, BLUE=Fore.BLUE, RED=Fore.RED))
            else:
                print(decode62(arg_mensage[1]))
        elif arg_mensage[0] == "basen":
            if arg_mensage[1] == "help":
                print(
                    """{YELLOW}basen{YELLOW}{BLUE} =>{BLUE}{RED}converte decimal em basen
        """.format(YELLOW=Fore.YELLOW, BLUE=Fore.BLUE, RED=Fore.RED))
            else:
                print(
                    numpy.base_repr(int(arg_mensage[1]),
                                    base=int(arg_mensage[2])))
        elif arg_mensage[0] == "url":
            try:
                if arg_mensage[1] == "help":
                    print(
                        """{YELLOW}url_encode{YELLOW}{BLUE} =>{BLUE}{RED}encode personalidado para url\nencode url_encode safa[] encoding"""
                        .format(YELLOW=Fore.YELLOW,
                                BLUE=Fore.BLUE,
                                RED=Fore.RED))
                else:
                    print(
                        quote(arg_mensage[1],
                              safe=arg_mensage[2],
                              encoding=arg_mensage[3]))
            except IndexError:
                print(
                    "digite a sintaxe correta\nncode url_encode safa[] encoding\n ou use o comando help"
                )
        elif arg_mensage[0] == "unicode_normalize":
            try:
                if arg_mensage[1] == "help":
                    print(
                        """{YELLOW}unicode_normalize{YELLOW}{BLUE} =>{BLUE}{RED}Transforme caracteres Unicode em uma das formas de normalização['NFC', 'NFKC', 'NFD','NFKD']\n                   
{YELLOW}NFD{YELLOW}{BLUE} =>{BLUE}{RED}Normalisation Form Canonical Decomposition
{YELLOW}NFC{YELLOW}{BLUE} =>{BLUE}{RED}Normalisation Form Canonical Composition
{YELLOW}NFKD{YELLOW}{BLUE} =>{BLUE}{RED}Normalisation Form Compatibility Decomposition
{YELLOW}NFKC{YELLOW}{BLUE} =>{BLUE}{RED}Normalisation Form Compatibility Composition    
encode unicode_normalize str encoding['NFC', 'NFKC', 'NFD','NFKD']\n""".format(
                            YELLOW=Fore.YELLOW, BLUE=Fore.BLUE, RED=Fore.RED))
                else:
                    print(unicodedata.normalize(arg_mensage[1],
                                                arg_mensage[2]))
            except IndexError:
                print(
                    "digite a sintaxe correta\nncode url_encode safa[] encoding\n ou use o comando help"
                )
        elif arg_mensage[0] == "qp_encoding":
            try:
                if arg_mensage[1] == "help":
                    print("""{YELLOW}qp_encoding{YELLOW}{BLUE} =>{BLUE}{RED}
                    Quoted-Printable, ou QP encoding, 
                    é uma codificação que usa caracteres ASCII imprimíveis (alfanuméricos e o sinal de igual '=') 
                    para transmitir dados de 8 bits em um caminho de dados de 7 bits ou, geralmente, em um meio que não é 8- um pouco limpo. 
                    É definido como uma codificação de transferência de conteúdo MIME para uso em e-mail.
                    QP funciona usando o sinal de igual '=' como um caractere de escape. Ele também limita o comprimento da linha a 76, pois alguns softwares têm limites no comprimento da linha\nencode qp_encoding TXT encode"""
                          .format(YELLOW=Fore.YELLOW,
                                  BLUE=Fore.BLUE,
                                  RED=Fore.RED))
                else:
                    encoded = quopri.encodestring(arg_mensage[1].encode(
                        arg_mensage[2]))
                    print(encoded.decode())
            except IndexError:
                print(
                    "digite a sintaxe correta\nencode qp_encoding é utf-16\n ou use o comando help"
                )
        elif arg_mensage[0] == "idna":
            try:
                if arg_mensage[1] == "help":
                    print(
                        """{YELLOW}idna{YELLOW}{BLUE} =>{BLUE}{RED}encode personalidado para url\nencode url_encode safa[] encoding"""
                        .format(YELLOW=Fore.YELLOW,
                                BLUE=Fore.BLUE,
                                RED=Fore.RED))
                else:
                    print(idna.encode(arg_mensage[1]).decode(arg_mensage[2]))
            except IndexError:
                print(
                    "digite a sintaxe correta\nncode idna string encoding\n ou use o comando help"
                )

        else:
            pass
        try:
            pass

        except IndexError:
            print("verificar a saida")
Ejemplo n.º 28
0
def parse_data(data, my_decode_flag, my_caesar_flag):
    my_answers = list()

    if my_decode_flag is True:

        for name in ('hex_codec', 'base64_codec', 'rot_13', 'utf_8',
                     'utf_16_be', 'utf_16_le', 'bz2', 'zip', 'idna', 'palmos',
                     'punycode', 'quopri_codec', 'utf_7'):
            try:
                result = data.decode(name)
                if verbose_flag:
                    print "%s succeeded" % name
                my_answers.append([name, repr(result)])
            except Exception as ex:
                if verbose_flag:
                    print "%s FAILED: %s" % (name, ex)

        name = 'base32'
        try:
            result = base64.b32decode(data)
            if verbose_flag:
                print "%s succeeded" % name
            my_answers.append([name, repr(result)])
        except Exception as ex:
            if verbose_flag:
                print "%s FAILED: %s" % (name, ex)

        name = 'uuencode'
        try:
            result = binascii.a2b_uu(data)
            if verbose_flag:
                print "%s succeeded" % name
            my_answers.append([name, repr(result)])
        except Exception as ex:
            if verbose_flag:
                print "%s FAILED: %s" % (name, ex)

        name = 'quotable'
        try:
            result = binascii.a2b_qp(data)
            if verbose_flag:
                print "%s succeeded" % name
            my_answers.append([name, repr(result)])
        except Exception as ex:
            if verbose_flag:
                print "%s FAILED: %s" % (name, ex)

        name = 'binhex4'
        try:
            result = binascii.rledecode_hqx(binascii.a2b_hqx(data))
            if verbose_flag:
                print "%s succeeded" % name
            my_answers.append([name, repr(result)])
        except Exception as ex:
            if verbose_flag:
                print "%s FAILED: %s" % (name, ex)

        name = 'yenc'
        try:
            decoder = yenc.Decoder()
            decoder.feed(data)
            result = decoder.getDecoded()
            if verbose_flag:
                print "%s succeeded" % name
            my_answers.append([name, repr(result)])
        except Exception as ex:
            if verbose_flag:
                print "%s FAILED: %s" % (name, ex)

    else:

        for name in ('hex_codec', 'base64_codec', 'rot_13', 'utf_8',
                     'utf_16_be', 'utf_16_le', 'bz2', 'zip', 'idna', 'palmos',
                     'punycode', 'quopri_codec', 'utf_7'):
            try:
                result = data.encode(name)
                if verbose_flag:
                    print "%s succeeded" % name
                my_answers.append([name, repr(result)])
            except Exception as ex:
                if verbose_flag:
                    print "%s FAILED: %s" % (name, ex)

        name = 'base32'
        try:
            result = base64.b32encode(data)
            if verbose_flag:
                print "%s succeeded" % name
            my_answers.append([name, repr(result)])
        except Exception as ex:
            if verbose_flag:
                print "%s FAILED: %s" % (name, ex)

        name = 'uuencode'
        try:
            result = binascii.b2a_uu(data)
            if verbose_flag:
                print "%s succeeded" % name
            my_answers.append([name, repr(result)])
        except Exception as ex:
            if verbose_flag:
                print "%s FAILED: %s" % (name, ex)

        name = 'quotable'
        try:
            result = binascii.b2a_qp(data)
            if verbose_flag:
                print "%s succeeded" % name
            my_answers.append([name, repr(result)])
        except Exception as ex:
            if verbose_flag:
                print "%s FAILED: %s" % (name, ex)

        name = 'binhex4'
        try:
            result = binascii.b2a_hqx(binascii.rlecode_hqx(data))
            if verbose_flag:
                print "%s succeeded" % name
            my_answers.append([name, repr(result)])
        except Exception as ex:
            if verbose_flag:
                print "%s FAILED: %s" % (name, ex)

        name = 'yenc'
        try:
            encoder = yenc.Encoder()
            encoder.feed(data)
            result = encoder.getEncoded()
            if verbose_flag:
                print "%s succeeded" % name
            my_answers.append([name, repr(result)])
        except Exception as ex:
            if verbose_flag:
                print "%s FAILED: %s" % (name, ex)

    if my_caesar_flag:
        for i in range(1, 256):
            my_answers.append([
                "Caesar_%d" % i,
                repr(''.join([chr((ord(c) + i) % 256) for c in data]))
            ])
            my_answers.append([
                "xor_%d" % i,
                repr(''.join([chr((ord(c) ^ i) % 256) for c in data]))
            ])

    return my_answers
Ejemplo n.º 29
0
"""Macintosh binhex compression/decompression.
Ejemplo n.º 30
0
def _load_logo():
    _ds9_python_logo_text = r"""8dP08%a&)#!p)*!89##3-N**9&"*@#!J25#3&$JJN$*139K*8b!J)$dJN"3b)*!b6N&B59-a)#!p)*!5-cFi)*!b6N&B59-b)#!p)*!5-6B`)*!b3PT&8NmJ)#!p)*!0-#i`N!BJN$*#8d0"6%8J)$dJN!da,M#3"L#3-N4"9%&058iJ25#3$6!Z-*!')*!b4%&838e"@#!p)*!,-M8e,M#3"L#3JNK*8e428PNJ9%K*8b"'5946)%C*6%8J9d&6)%G&6N95394&4#"#@5"(58e3)&9658j()%C*9&059b#3Cd0268e&6P3J4QPdFe*A)'Pc)#K$+5"3CA4PFL",DA*MD'GPFh0ZCA)J+("PG'9b3'YTFQ0SCf9cFfjPFLjZCA3T,#"LGA3JBACKD@aKBQaP3dp068919#"eEQ4PFL"dD'8J4dj9)'GPEQ9bB@`JF(9LE'PM)'aTBf9ZBf8Z)*!M3dp068919#"'Eh)JFfpeFQ0PFb"cC@8JD(4dF$S[,hGhGbjVDA*MD'GPFh0ZCA)ZEQ9d)*"Y3dp068919#"*E@&RC5"dHA"P)(GTG'KTEL"(58e31L"(58e3Ae*(3Pp*68&(45#3)N0268e&6P3J8f9aG@9ZBf8JCQpb)%j"@%P6-b!J)$SJ8N9%,#"(8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'lbrj"lj16prj#Hjr2rN&RQq2q3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3rrq3M300"""

    import binascii
    _ds9_python_logo = binascii.a2b_hqx(_ds9_python_logo_text.encode("ascii"))[0]
    return binascii.rledecode_hqx(_ds9_python_logo)
Ejemplo n.º 31
0
 if binhex == 2 and binhexline:
     l = len(binhexline)
     eof = 0
     while l > 0:
         #		    print "l=%d" % (l)
         try:
             curbin, eof = binascii.a2b_hqx(binhexline[:l])
             #			print "BinHex: %d bytes decoded from %d/%d chars, EOF: %d" % (len(curbin),l,len(binhexline),eof)
             binhexdata += curbin
             binhexline = binhexline[l:]
             break
         except binascii.Incomplete:
             l -= 1
     if eof:
         #		    print "BinHex: done hqx decoding, size: %d" % (len(binhexdata))
         binhexdata = binascii.rledecode_hqx(binhexdata)
         hqxsize = len(binhexdata)
         #		    print "BinHex: done rle decoding, size: %d" % (hqxsize)
         # check for the header:
         fnlen = ord(binhexdata[0])
         #		    print "BinHex fnlen=%d" % (fnlen)
         if hqxsize <= 22 + fnlen:
             #			print "BinHex: invalid header / file truncated! writting out raw data."
             hqxfilename = [None, "BinHex.dat", None, None]
             hdrlen = 0
         else:
             hqxfilename = [
                 None,
                 unicode(binhexdata[1:1 + fnlen].strip(),
                         "latin-1"), None,
                 binhexdata[2 + fnlen:2 + fnlen + 4]
Ejemplo n.º 32
0
def decodeData(str):
    return cPickle.loads(binascii.rledecode_hqx(binascii.a2b_base64(str)))
Ejemplo n.º 33
0
def decodeData(str):
     return cPickle.loads(binascii.rledecode_hqx(binascii.a2b_base64(str)))
Ejemplo n.º 34
0
def test():
    for _ in range(9999):
        try:
            binascii.a2b_uu(fstr())
        except (binascii.Error, binascii.Incomplete):
            pass

        try:
            binascii.b2a_uu(fstr())
        except (binascii.Error, binascii.Incomplete):
            pass

        try:
            binascii.a2b_base64(fstr())
        except (binascii.Error, binascii.Incomplete):
            pass

        try:
            binascii.b2a_base64(fstr(), newline=fbool())
        except (binascii.Error, binascii.Incomplete):
            pass

        try:
            binascii.a2b_qp(fstr(), header=fbool())
        except (binascii.Error, binascii.Incomplete):
            pass

        try:
            binascii.b2a_qp(fstr(),
                            quotetabs=fbool(),
                            istext=fbool(),
                            header=fbool())
        except (binascii.Error, binascii.Incomplete):
            pass

        try:
            binascii.a2b_hqx(fstr())
        except (binascii.Error, binascii.Incomplete):
            pass

        try:
            binascii.rledecode_hqx(fstr())
        except (binascii.Error, binascii.Incomplete):
            pass

        try:
            binascii.rlecode_hqx(fstr())
        except (binascii.Error, binascii.Incomplete):
            pass

        try:
            binascii.b2a_hqx(fstr())
        except (binascii.Error, binascii.Incomplete):
            pass

        try:
            binascii.crc_hqx(fstr(), flong())
        except (binascii.Error, binascii.Incomplete):
            pass

        try:
            binascii.crc32(fstr())
        except (binascii.Error, binascii.Incomplete):
            pass

        try:
            binascii.crc32(fstr(), flong())
        except (binascii.Error, binascii.Incomplete):
            pass

        try:
            binascii.b2a_hex(fstr())
        except (binascii.Error, binascii.Incomplete):
            pass

        try:
            binascii.hexlify(fstr())
        except (binascii.Error, binascii.Incomplete):
            pass

        try:
            binascii.a2b_hex(fstr())
        except (binascii.Error, binascii.Incomplete):
            pass

        try:
            binascii.unhexlify(fstr())
        except (binascii.Error, binascii.Incomplete):
            pass
 def test_rlecode_hqx_rledecode_hqx_round_trip(self, payload):
     x = binascii.rlecode_hqx(payload)
     self.assertEqual(payload, binascii.rledecode_hqx(x))
Ejemplo n.º 36
0
else:
    onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
    for fName in onlyfiles:
        if (fName.find(".rvd") > 0) and (fName.find("HD") > 0):
            files.append(fName)

if args.output:
    out = args.output
else:
    out = "ServiceCenterAddressBook.xadr"

for f in files:
    with open(f, "rb") as binary_file:
        # Read the whole file at once
        data = binary_file.read()
        a_data = binascii.rledecode_hqx(data)
        for line in iter(a_data.splitlines()):
            host = {}
            if (line.find('10.') >= 0):
                arr = re.split(' ',line)
                for item in arr:
                    room = ""
                    bldg = ""
                    if (item.find('10.') >= 0):
                        if (item.find("HD") >= 0):
                            room = arr[arr.index(item) - 1]
                            bldg = arr[arr.index(item) - 2]
                        elif (item.find("ite") >= 0):
                            room = arr[arr.index(item) - 1]
                            bldg = arr[arr.index(item) - 2]
                        else:
Ejemplo n.º 37
0
    def searchBitMap(self, db, keyword, encoded=True):

        self.SearchDocIDList = []
        #self.webDocs = {}
        self.searchWords = ''
        self.wordList = []
        self.startTime = 0
        self.elapsedTime = ''

        self.encoded = encoded
        word = ''
        totalResult = 0

        self.searchWords = keyword
        if not self.searchWords:
            #CommonFunctions.ShowErrorMessage(self, "Failed to Export Phone List. Error: %s"%value)
            return

        if encoded:
            query = "select keyword, compressed from %s where (Keyword = " % Constants.TextCatBitMapIndex
        else:
            query = "select keyword, bitmap from %s where (Keyword = '" % Constants.TextCatBitMapIndex

        i = 0
        for word in string.split(self.searchWords, ' '):
            word = word.strip().lower()
            word = word.strip('"')

            if word not in Globals.EmailsStopwords:
                i += 1
                self.wordList.append(word)
                if i == 1:
                    query += db.SqlSQuote(word)
                else:
                    query += " or keyword = %s" % (db.SqlSQuote(word))

        query += ")"
        if self.wordList < 0:
            return None

        #print query
        bitMap = []
        docIndex = 0

        #print query
        rows = db.FetchAllRows(query)
        totalResult = len(rows)
        """
        if totalResult < len(self.wordList):
            self.elapsedTime = CommonFunctions.ConvertSecondsToYearDayHourMinSec(time.time() - self.startTime)
            self.MessagesHeading = "%d Results for %s (%s)"%(len(self.SearchDocIDList), self.searchWords, self.elapsedTime)
            return None
        """

        if totalResult < 1:
            self.elapsedTime = CommonFunctions.ConvertSecondsToYearDayHourMinSec(
                time.time() - self.startTime)
            self.MessagesHeading = "%d Results for %s (%s)" % (len(
                self.SearchDocIDList), self.searchWords, self.elapsedTime)
            return None

        if totalResult == 1:
            if self.encoded:
                bitMap = binascii.rledecode_hqx(rows[0][1])
            else:
                bitMap = rows[0][1]
        elif totalResult > 1:
            if self.encoded:
                bits = binascii.rledecode_hqx(rows[0][1])
                for bit in bits:
                    bitMap.append(bit)
            else:
                for bit in rows[0][1]:  # get the bitmap of first word/row
                    bitMap.append(bit)

        i = 1

        while i < totalResult:
            row = rows[i]
            i += 1
            index = 0  # start from the beginning of the bitmap
            if encoded:
                bits = binascii.rledecode_hqx(row[1])
            else:
                bits = row[1]

            for bit in bits:
                if self.searchWords.startswith('"'):
                    bitMap[index] = str(int(bitMap[index]) & int(bit))

                else:
                    bitMap[index] = str(int(bitMap[index]) | int(bit))
                index += 1

        #print bitMap
        docIndex = 1
        for bit in bitMap:
            if bit == '1':
                #if len(self.docIDString) >= 1:
                #    self.docIDString += ','
                self.SearchDocIDList.append(docIndex)
                #self.docIDString += str(docIndex)
            docIndex += 1

        if len(self.SearchDocIDList) == 0:
            return

        if keyword.startswith('"'):
            keyword = keyword.replace('"', "'")

        msgOutputPath = os.path.join(self.MessageOutputPath, keyword)
        try:
            os.makedirs(msgOutputPath)
        except:
            pass

        for key in Globals.MessageDict:
            for msg in Globals.MessageDict[key]:
                if msg.DocID in self.SearchDocIDList:
                    destPath = os.path.join(msgOutputPath,
                                            os.path.basename(msg.filePath))
                    if not os.path.isfile(destPath):
                        shutil.copyfile(msg.filePath, destPath)