Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Memri
pymemri
Commits
4a952598
Commit
4a952598
authored
3 years ago
by
Eelco van der Wel
💬
Browse files
Options
Download
Email Patches
Plain Diff
password simulator
parent
b68c11e2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pymemri/client_simulator/password_simulator.py
+46
-0
pymemri/client_simulator/password_simulator.py
settings.ini
+1
-1
settings.ini
with
47 additions
and
1 deletion
+47
-1
pymemri/client_simulator/password_simulator.py
0 → 100644
+
46
-
0
View file @
4a952598
from
pymemri.pod.client
import
PodClient
import
time
from
fastscript
import
call_parse
,
Param
SLEEP_INTERVAL
=
1
def
input_credentials
():
username
=
input
(
"Enter username: "
)
password
=
input
(
"Enter password: "
)
return
username
,
password
@
call_parse
def
run_password_simulator
(
database_key
:
Param
(
"database key"
,
str
)
=
None
,
owner_key
:
Param
(
"owner key"
,
str
)
=
None
,
run_id
:
Param
(
"owner key"
,
str
)
=
None
):
client
=
PodClient
(
database_key
=
database_key
,
owner_key
=
owner_key
)
while
True
:
time
.
sleep
(
SLEEP_INTERVAL
)
pluginRun
=
client
.
get
(
run_id
)
if
pluginRun
.
state
==
"userActionNeeded"
:
username
,
password
=
input_credentials
()
pluginRun
.
identifier
=
username
pluginRun
.
secret
=
password
pluginRun
.
state
=
"ready"
client
.
update
(
pluginRun
)
elif
pluginRun
.
state
==
"started"
:
print
(
"plugin starting..."
)
elif
pluginRun
.
state
==
"ready"
:
print
(
"no user action needed."
)
elif
pluginRun
.
state
==
"error"
:
print
(
"error occurred in plugin."
)
break
elif
pluginRun
.
state
==
"done"
:
break
else
:
print
(
f
"unknown plugin state
{
pluginRun
.
state
}
."
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
settings.ini
+
1
-
1
View file @
4a952598
...
...
@@ -15,7 +15,7 @@ language = English
custom_sidebar
=
True
license
=
apache2
status
=
2
console_scripts
=
run_plugin=pymemri.plugin.pluginbase:run_plugin simulate_run_plugin_from_frontend=pymemri.plugin.pluginbase:simulate_run_plugin_from_frontend store_keys=pymemri.plugin.pluginbase:store_keys qr_simulator=pymemri.client_simulator.qr_simulator:run_qr_simulator
console_scripts
=
run_plugin=pymemri.plugin.pluginbase:run_plugin simulate_run_plugin_from_frontend=pymemri.plugin.pluginbase:simulate_run_plugin_from_frontend store_keys=pymemri.plugin.pluginbase:store_keys qr_simulator=pymemri.client_simulator.qr_simulator:run_qr_simulator
password_simulator=pymemri.client_simulator.password_simulator:run_password_simulator
requirements
=
requests tqdm ipdb fastprogress fastscript opencv-python fastcore==1.3.20 nbdev==1.1.5 matplotlib flask==2.0.1
nbs_path
=
nbs
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment