FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Python/BruteForce.py at master · isbase/Python · GitHub
isbase
/
Python
Public
forked from
geekcomputers/Python
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Python
/
BruteForce.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
85 lines (58 loc) · 2.04 KB
Breadcrumbs
Python
/
BruteForce.py
Copy path
File metadata and controls
85 lines (58 loc) · 2.04 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
from
itertools
import
product
def
findPassword
(
chars
,
function
,
show
=
50
,
format_
=
"%s"
):
password
=
None
attempts
=
0
size
=
1
stop
=
False
while
not
stop
:
# Obtém todas as combinações possíveis com os dígitos do parâmetro "chars".
for
pw
in
product
(
chars
,
repeat
=
size
):
password
=
""
.
join
(
pw
)
# Imprime a senha que será tentada.
if
attempts
%
show
==
0
:
print
(
format_
%
password
)
# Verifica se a senha é a correta.
if
function
(
password
):
stop
=
True
break
else
:
attempts
+=
1
size
+=
1
return
password
,
attempts
def
getChars
():
"""
Método para obter uma lista contendo todas as
letras do alfabeto e números.
"""
chars
=
[]
# Acrescenta à lista todas as letras maiúsculas
for
id_
in
range
(
ord
(
"A"
),
ord
(
"Z"
)
+
1
):
chars
.
append
(
chr
(
id_
))
# Acrescenta à lista todas as letras minúsculas
for
id_
in
range
(
ord
(
"a"
),
ord
(
"z"
)
+
1
):
chars
.
append
(
chr
(
id_
))
# Acrescenta à lista todos os números
for
number
in
range
(
10
):
chars
.
append
(
str
(
number
))
return
chars
# Se este módulo não for importado, o programa será testado.
# Para realizar o teste, o usuário deverá inserir uma senha para ser encontrada.
if
__name__
==
"__main__"
:
import
datetime
import
time
# Pede ao usuário uma senha
pw
=
input
(
"
\n
Type a password: "
)
print
(
"
\n
"
)
def
testFunction
(
password
):
global
pw
if
password
==
pw
:
return
True
else
:
return
False
# Obtém os dígitos que uma senha pode ter
chars
=
getChars
()
t
=
time
.
process_time
()
# Obtém a senha encontrada e o múmero de tentativas
password
,
attempts
=
findPassword
(
chars
,
testFunction
,
show
=
1000
,
format_
=
" Trying %s"
)
t
=
datetime
.
timedelta
(
seconds
=
int
(
time
.
process_time
()
-
t
))
input
(
f"
\n
\n
Password found:
{
password
}
\n
Attempts:
{
attempts
}
\n
Time:
{
t
}
\n
"
)
Back
|
FazBrowse Home
|
New Git URL