999code-tool 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: 999code-tool
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Uma ferramenta para inspecionar, extrair e formatar arquivos.
|
|
5
|
+
Author-email: antonio Da Silva <advanceantonio@gmail.com>
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.7
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
# 999code
|
|
15
|
+
|
|
16
|
+
Uma ferramenta para inspecionar, extrair e formatar arquivos no terminal.
|
|
17
|
+
|
|
18
|
+
## Como usar
|
|
19
|
+
Após instalar, digite `999code` no seu terminal.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
code.py,sha256=rfJNinpLQEN9VVgnslGN2Mc_ywuKXA9Hc2S3atCmyyU,7199
|
|
2
|
+
999code_tool-0.1.0.dist-info/licenses/LICENSE,sha256=5dz_6Da27IpY5JJBm1UOZfuMvcMIUDl55drLM6x-o7c,3
|
|
3
|
+
999code_tool-0.1.0.dist-info/METADATA,sha256=X_3dEh6bczS7QUlpz1lypSlu4KayKtUkJrSm6CvOsbA,588
|
|
4
|
+
999code_tool-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
5
|
+
999code_tool-0.1.0.dist-info/entry_points.txt,sha256=6qpR1-psqeBAYn1XzzwI3aEhmeujnPKdzHbkDfJf3xE,49
|
|
6
|
+
999code_tool-0.1.0.dist-info/top_level.txt,sha256=tXsjbJvNKmH81ie2muLXputbwT8twlMRNI7gjfQ7wMQ,5
|
|
7
|
+
999code_tool-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
code
|
code.py
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import base64
|
|
3
|
+
import zipfile
|
|
4
|
+
import json
|
|
5
|
+
|
|
6
|
+
# Cores ANSI para o Terminal (Sólidas e Brilhantes)
|
|
7
|
+
CIANO = '\033[1;36m'
|
|
8
|
+
VERDE = '\033[1;32m'
|
|
9
|
+
VERMELHO = '\033[1;31m'
|
|
10
|
+
AMARELO = '\033[1;33m'
|
|
11
|
+
RESET = '\033[0m'
|
|
12
|
+
|
|
13
|
+
def exibir_banner():
|
|
14
|
+
os.system('clear' if os.name != 'nt' else 'cls')
|
|
15
|
+
print(f"{CIANO}")
|
|
16
|
+
print(r" ██████╗ ██████╗ ██████╗ ██████╗ ██████╗ ██████╗ ███████╗")
|
|
17
|
+
print(r" ██╔═███╗ ██╔═███╗ ██╔═███╗██╔════╝██╔═══██╗██╔══██╗██╔════╝")
|
|
18
|
+
print(r" ╚██████║ ╚██████║ ╚██████║██║ ██║ ██║██║ ██║█████╗ ")
|
|
19
|
+
print(r" ██╔═══╝ ██╔═══╝ ██╔═══╝██║ ██║ ██║██║ ██║██╔══╝ ")
|
|
20
|
+
print(r" ██║ ██║ ██║ ╚██████╗╚██████╔╝██████╔╝███████╗")
|
|
21
|
+
print(r" ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝")
|
|
22
|
+
print(f"{RESET}")
|
|
23
|
+
print(f"{VERDE} [ Créditos: 999GenioDeV ]{RESET}\n")
|
|
24
|
+
|
|
25
|
+
def listar_arquivos():
|
|
26
|
+
script_nome = os.path.basename(__file__)
|
|
27
|
+
arquivos = [f for f in os.listdir('.') if os.path.isfile(f) and f != script_nome]
|
|
28
|
+
if arquivos:
|
|
29
|
+
print(f"{AMARELO}[Arquivos na pasta atual]:{RESET}")
|
|
30
|
+
for i, arquivo in enumerate(arquivos, 1):
|
|
31
|
+
print(f" [{VERDE}{i}{RESET}] {arquivo}")
|
|
32
|
+
return arquivos
|
|
33
|
+
print(f"\n{VERMELHO}[Aviso]{RESET} Nenhum outro arquivo encontrado nesta pasta.")
|
|
34
|
+
return []
|
|
35
|
+
|
|
36
|
+
def selecionar_arquivo():
|
|
37
|
+
arquivos = listar_arquivos()
|
|
38
|
+
if not arquivos:
|
|
39
|
+
return None
|
|
40
|
+
try:
|
|
41
|
+
escolha = input(f"\nEscolha o número do arquivo (ou digite o nome): ").strip()
|
|
42
|
+
if escolha.isdigit():
|
|
43
|
+
idx = int(escolha) - 1
|
|
44
|
+
if 0 <= idx < len(arquivos):
|
|
45
|
+
return arquivos[idx]
|
|
46
|
+
if os.path.exists(escolha):
|
|
47
|
+
return escolha
|
|
48
|
+
print(f"{VERMELHO}[Erro]{RESET} Seleção inválida.")
|
|
49
|
+
return None
|
|
50
|
+
except Exception:
|
|
51
|
+
return None
|
|
52
|
+
|
|
53
|
+
def inspecionar_arquivo(nome):
|
|
54
|
+
if not nome: return
|
|
55
|
+
try:
|
|
56
|
+
with open(nome, 'rb') as f:
|
|
57
|
+
bytes_iniciais = f.read(16)
|
|
58
|
+
print(f"\n{CIANO}Hex do arquivo:{RESET} {bytes_iniciais.hex(' ')}")
|
|
59
|
+
print(f"{CIANO}Texto aproximado:{RESET} {bytes_iniciais}")
|
|
60
|
+
|
|
61
|
+
if bytes_iniciais.startswith(b'PK\x03\x04'):
|
|
62
|
+
print(f"{VERDE}-> Identificado: Arquivo ZIP ou Zipapp (Pronto para extração!).{RESET}")
|
|
63
|
+
elif bytes_iniciais.startswith(b'#!'):
|
|
64
|
+
print(f"{AMARELO}-> Identificado: Script com cabeçalho Linux/Termux (Pode conter dados ocultos).{RESET}")
|
|
65
|
+
else:
|
|
66
|
+
print(f"-> Identificado: Binário genérico ou texto puro.")
|
|
67
|
+
except Exception as e:
|
|
68
|
+
print(f"{VERMELHO}[Erro ao inspecionar]:{RESET} {e}")
|
|
69
|
+
|
|
70
|
+
def extrair_zip_ou_zipapp(nome):
|
|
71
|
+
if not nome: return
|
|
72
|
+
pasta_saida = f"extraido_{nome.replace('.', '_')}"
|
|
73
|
+
try:
|
|
74
|
+
with zipfile.ZipFile(nome, 'r') as zip_ref:
|
|
75
|
+
zip_ref.extractall(pasta_saida)
|
|
76
|
+
print(f"\n{VERDE}[Sucesso] Tudo extraído para a pasta: '{pasta_saida}'{RESET}")
|
|
77
|
+
except zipfile.BadZipFile:
|
|
78
|
+
print(f"\n{VERMELHO}[Erro]{RESET} O arquivo não parece ser um ZIP ou Zipapp válido.")
|
|
79
|
+
except Exception as e:
|
|
80
|
+
print(f"\n{VERMELHO}[Erro]:{RESET} {e}")
|
|
81
|
+
|
|
82
|
+
def formatar_json(nome):
|
|
83
|
+
if not nome: return
|
|
84
|
+
try:
|
|
85
|
+
# Abre o arquivo JSON bagunçado
|
|
86
|
+
with open(nome, 'r', encoding='utf-8', errors='ignore') as f:
|
|
87
|
+
dados = json.load(f)
|
|
88
|
+
|
|
89
|
+
nome_saida = f"formatado_{nome}"
|
|
90
|
+
# Salva ele identado (com quebras de linha e espaços organizados)
|
|
91
|
+
with open(nome_saida, 'w', encoding='utf-8') as f:
|
|
92
|
+
json.dump(dados, f, indent=4, ensure_ascii=False)
|
|
93
|
+
|
|
94
|
+
print(f"\n{VERDE}[Sucesso] JSON decodificado/formatado com sucesso!{RESET}")
|
|
95
|
+
print(f"Salvo como: {nome_saida}")
|
|
96
|
+
except json.JSONDecodeError as e:
|
|
97
|
+
print(f"\n{VERMELHO}[Erro] O arquivo não contém um estrutura JSON válida.{RESET}")
|
|
98
|
+
print(f"Detalhes do erro: {e}")
|
|
99
|
+
except Exception as e:
|
|
100
|
+
print(f"\n{VERMELHO}[Erro]:{RESET} {e}")
|
|
101
|
+
|
|
102
|
+
def processar_codec(nome, formato, acao):
|
|
103
|
+
if not nome: return
|
|
104
|
+
try:
|
|
105
|
+
with open(nome, 'rb') as f:
|
|
106
|
+
dados = f.read()
|
|
107
|
+
|
|
108
|
+
if acao == 'codificar':
|
|
109
|
+
resultado = base64.b64encode(dados) if formato == 'b64' else dados.hex().encode()
|
|
110
|
+
sufixo = f"codificado_{formato}"
|
|
111
|
+
else:
|
|
112
|
+
if formato == 'b64':
|
|
113
|
+
resultado = base64.b64decode(dados)
|
|
114
|
+
else:
|
|
115
|
+
dados_limpos = dados.decode('utf-8', errors='ignore').strip().replace(" ", "").replace("\n", "")
|
|
116
|
+
resultado = bytes.fromhex(dados_limpos)
|
|
117
|
+
sufixo = f"descodificado_{formato}"
|
|
118
|
+
|
|
119
|
+
nome_saida = f"{sufixo}_{nome}"
|
|
120
|
+
with open(nome_saida, 'wb') as f:
|
|
121
|
+
f.write(resultado)
|
|
122
|
+
print(f"\n{VERDE}[Sucesso] Salvo com êxito como: {nome_saida}{RESET}")
|
|
123
|
+
except Exception as e:
|
|
124
|
+
print(f"\n{VERMELHO}[Erro no processamento]:{RESET} {e}")
|
|
125
|
+
|
|
126
|
+
def menu():
|
|
127
|
+
while True:
|
|
128
|
+
exibir_banner()
|
|
129
|
+
print("1. Inspecionar Arquivo (Verificar cabeçalho e tipo)")
|
|
130
|
+
print("2. Extrair Código de Zipapp / ZIP (Casos como o dnsfinder)")
|
|
131
|
+
print("3. Codificar arquivo (Base64 / Hex)")
|
|
132
|
+
print("4. Descodificar arquivo (Base64 / Hex)")
|
|
133
|
+
print("5. Formatar/Deixar Legível Arquivo JSON")
|
|
134
|
+
print("6. Sair")
|
|
135
|
+
|
|
136
|
+
opcao = input(f"\n{CIANO}Escolha uma opção (1-6): {RESET}").strip()
|
|
137
|
+
|
|
138
|
+
if opcao == '6':
|
|
139
|
+
print(f"\n{VERDE}Saindo... Ferramenta encerrada. Até logo!{RESET}")
|
|
140
|
+
break
|
|
141
|
+
if opcao not in ['1', '2', '3', '4', '5']:
|
|
142
|
+
input(f"\n{VERMELHO}[Opção Inválida]{RESET} Pressione Enter para tentar novamente...")
|
|
143
|
+
continue
|
|
144
|
+
|
|
145
|
+
print()
|
|
146
|
+
arquivo = selecionar_arquivo()
|
|
147
|
+
if not arquivo:
|
|
148
|
+
input(f"\nPressione Enter para voltar ao menu...")
|
|
149
|
+
continue
|
|
150
|
+
|
|
151
|
+
if opcao == '1':
|
|
152
|
+
inspecionar_arquivo(arquivo)
|
|
153
|
+
elif opcao == '2':
|
|
154
|
+
extrair_zip_ou_zipapp(arquivo)
|
|
155
|
+
elif opcao == '5':
|
|
156
|
+
formatar_json(arquivo)
|
|
157
|
+
elif opcao in ['3', '4']:
|
|
158
|
+
acao = 'codificar' if opcao == '3' else 'descodificar'
|
|
159
|
+
print(f"\nFormatos: [{VERDE}1{RESET}] Base64 | [{VERDE}2{RESET}] Hexadecimal")
|
|
160
|
+
fmt = input("Escolha o formato: ").strip()
|
|
161
|
+
formato = 'b64' if fmt == '1' else 'hex' if fmt == '2' else None
|
|
162
|
+
if formato:
|
|
163
|
+
processar_codec(arquivo, formato, acao)
|
|
164
|
+
else:
|
|
165
|
+
print(f"{VERMELHO}[Formato Inválido]{RESET}")
|
|
166
|
+
|
|
167
|
+
input(f"\n{AMARELO}Pressione Enter para continuar...{RESET}")
|
|
168
|
+
|
|
169
|
+
if __name__ == '__main__':
|
|
170
|
+
menu()
|