-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
client.py
121 lines (100 loc) · 3.43 KB
/
client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# ______ ______ _____ ___
# / __/ /____ ___ ___ _ / ___(_) _/ /_ / _ \___ ________ ___ ____
# _\ \/ __/ -_) _ `/ ' \ / (_ / / _/ __/ / ___/ _ `/ __(_-</ -_) __/
# /___/\__/\__/\_,_/_/_/_/ \___/_/_/ \__/ /_/ \_,_/_/ /___/\__/_/
#
# Created by: github.com/PalmaLuv
# Stay tuned for further app updates
# License : MPL-2.0
import six
from InquirerPy import prompt
from prompt_toolkit import document as doc
from prompt_toolkit.validation import ValidationError, Validator
from main import config
import keyboard
import clipboard
import os
try:
from colorama import init, Fore
init()
except ImportError:
Fore = None
from logs import editFileLog, createFileLog
array_logo = [" ______ ______ _____ ___ ",
" / __/ /____ ___ ___ _ / ___(_) _/ /_ / _ \___ ________ ___ ____",
" _\ \/ __/ -_) _ `/ ' \ / (_ / / _/ __/ / ___/ _ `/ __(_-</ -_) __/",
" /___/\__/\__/\_,_/_/_/_/ \___/_/_/ \__/ /_/ \_,_/_/ /___/\__/_/ " ]
# Storing the right variables.
class statusLogs:
def __init__(self):
self._valLogs = False
self._valTextConsole = 0
@property
def valTextConsole(self):
return self._valTextConsole
@property
def valLogs(self):
return self._valLogs
@valTextConsole.setter
def valTextConsole(self, value):
self._valTextConsole = value
@valLogs.setter
def valLogs(self, value):
self._valLogs = value
boolLogs = statusLogs()
def createdLogs(status):
if True == status:
createFileLog()
boolLogs.valLogs = status
def log(str, color="white"):
if boolLogs.valTextConsole < 60:
boolLogs.valTextConsole += 1
elif 60 <= boolLogs.valTextConsole:
boolLogs.valTextConsole = 0
os.system('cls')
if boolLogs.valLogs:
editFileLog(str.replace('\n', ' '))
if Fore:
fore_str = getattr(Fore, color.upper()) + str + Fore.RESET
six.print_(fore_str)
else:
six.print_(str)
class PointValidator(Validator):
def validate(self, document: doc.Document):
value = document.text
try:
value = int(value)
except Exception:
raise Exception('Value should be greater than 0')
if value <= 0:
raise Exception('Value should be greater than 0')
return True
def ask(type, name, msg, choices=[]):
questions = [
{
'type' : type,
'name' : name,
'message' : msg
}
]
if choices:
questions[0].update({'choices':choices})
if type == 'input':
keyboard.add_hotkey('ctrl+v', lambda: keyboard.write(clipboard.paste()))
answers = prompt(questions)
keyboard.remove_hotkey('ctrl+v')
else :
answers = prompt(questions)
return answers
def askReadConfig(cookie_value, log_info_value):
config.set('DEFAULT', 'cookie', cookie_value)
config.set('DEFAULT', 'log_info', str(log_info_value))
with open('config.ini', 'w') as configFile:
config.write(configFile)
def askCookie():
cookie = ask('input', 'cookie', 'Enter PHPSESSID cookie')
return cookie['cookie']
def askLog():
log = ask('confirm', 'logs',
'Do you want to leave a log file after each run of the script?')['logs']
return log