Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
bc596d4e
authored
Feb 06, 2013
by
tarokkk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
laborclient: Fixed enc.py
parent
a8d35c33
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
21 deletions
+27
-21
miscellaneous/laborclient/enc.pl
+11
-3
miscellaneous/laborclient/enc.py
+16
-18
No files found.
miscellaneous/laborclient/enc.pl
View file @
bc596d4e
...
...
@@ -13,6 +13,7 @@ $::dummyString = "{{{{";
#
my
$password
=
@ARGV
[
0
];
print
$password
,
"\n"
;
print
encodePassword
(
$password
),
"\n"
;
my
$scrambled_string
=
scrambleString
(
$password
);
print
$scrambled_string
,
"\n"
;
...
...
@@ -83,7 +84,7 @@ sub getRandomValidCharFromList
my
$tm
=
localtime
;
my
$k
=
(
$tm
->
sec
);
return
0
;
return
getvalidCharList
(
0
)
;
}
...
...
@@ -100,6 +101,7 @@ sub scrambleString
if
(
length
(
$str
)
<
32
)
{
$sRet
.=
$::dummyString
;
print
"Added dummy $sRet\n"
;
}
for
(
my
$iR
=
(
length
(
$str
)
-
1
);
$iR
>=
0
;
$iR
--
)
...
...
@@ -108,32 +110,38 @@ sub scrambleString
#Reverse string.
#
$sRet
.=
substr
(
$str
,
$iR
,
1
);
print
"Reverse: $sRet\n"
;
}
if
(
length
(
$sRet
)
<
32
)
{
$sRet
.=
$::dummyString
;
print
"Added dummy2 $sRet\n"
;
}
my
$app
=
getRandomValidCharFromList
();
print
"Random valid char: $app\n"
;
my
$k
=
ord
(
$app
);
my
$l
=
$k
+
length
(
$sRet
)
-
2
;
$sRet
=
$app
.
$sRet
;
print
"Random $sRet\n\n"
;
for
(
my
$i1
=
1
;
$i1
<
length
(
$sRet
);
$i1
++
)
{
my
$app2
=
substr
(
$sRet
,
$i1
,
1
);
print
"For cycle app2= $app2\n}"
;
my
$j
=
findCharInList
(
$app2
);
print
"For cícle j= $j\n"
;
if
(
$j
==
-
1
)
{
return
$sRet
;
}
my
$i
=
(
$j
+
$l
*
(
$i1
+
1
))
%
$
::numValidCharList
;
print
"For cícle: i= $i\n"
;
my
$car
=
getvalidCharList
(
$i
);
$sRet
=
substr_replace
(
$sRet
,
$car
,
$i1
,
1
);
print
"For cycle sRet: $sRet\n\n"
}
my
$c
=
(
ord
(
getRandomValidCharFromList
()))
+
2
;
...
...
miscellaneous/laborclient/enc.py
View file @
bc596d4e
...
...
@@ -3,6 +3,7 @@
import
sys
import
random
import
re
from
xml.sax.saxutils
import
escape
numValidCharList
=
85
dummyString
=
"{{{{"
...
...
@@ -51,8 +52,8 @@ def findCharInList(c):
return
i
def
getRandomValidCharFromList
():
#
return getvalidCharList(random.randint(0,60))
return
getvalidCharList
(
0
)
return
getvalidCharList
(
random
.
randint
(
0
,
60
))
#
return getvalidCharList(0)
def
scrambleString
(
s
):
...
...
@@ -63,24 +64,31 @@ def scrambleString(s):
strp
=
encodePassword
(
s
)
if
len
(
strp
)
<
32
:
sRet
+=
dummyString
for
iR
in
reversed
(
range
(
len
(
strp
)
-
1
)):
#print "Added dummy "+sRet
for
iR
in
reversed
(
range
(
len
(
strp
))):
sRet
+=
strp
[
iR
:
iR
+
1
]
#print "Reverse: "+sRet
if
len
(
sRet
)
<
32
:
sRet
+=
dummyString
#print "Added dummy2 "+sRet
app
=
getRandomValidCharFromList
()
#print "Random valid char: "+app
k
=
ord
(
app
)
l
=
k
+
len
(
sRet
)
-
2
sRet
=
app
+
sRet
#print "Random "+sRet+"\n"
for
i1
in
range
(
1
,
len
(
sRet
)):
app2
=
sRet
[
i1
:
i1
+
1
]
#print "For cycle app2= "+str(app2)
j
=
findCharInList
(
app2
)
#print "For cycle j= "+str(j)
if
j
==
-
1
:
return
sRet
i
=
(
j
+
l
*
(
i1
+
1
))
%
numValidCharList
#print "For cycle i= "+str(i)
car
=
getvalidCharList
(
i
)
sRet
=
substr_replace
(
sRet
,
car
,
i1
,
1
)
#print "For cycle sRet: "+sRet+"\n"
c
=
(
ord
(
getRandomValidCharFromList
()))
+
2
c2
=
chr
(
c
)
sRet
=
sRet
+
c2
...
...
@@ -88,18 +96,7 @@ def scrambleString(s):
def
URLEncode
(
url
):
theURL
=
url
#theURL =~ s/&/&/g;
url
=
re
.
sub
(
"&"
,
"&"
,
url
)
#theURL =~ s/\"\"/"/g;
url
=
re
.
sub
(
"
\"
"
,
"""
,
url
)
#theURL =~ s/\'/'/g;
url
=
re
.
sub
(
"
\"
"
,
"""
,
url
)
#theURL =~ s/</</g;
url
=
re
.
sub
(
"<"
,
"<"
,
url
)
#theURL =~ s/>/>/g;
url
=
re
.
sub
(
">"
,
">"
,
url
)
return
theURL
return
escape
(
url
)
def
substr_replace
(
in_str
,
ch
,
pos
,
qt
):
clist
=
list
(
in_str
)
...
...
@@ -116,6 +113,7 @@ def substr_replace(in_str,ch,pos,qt):
if
__name__
==
"__main__"
:
password
=
sys
.
argv
[
0
]
password
=
sys
.
argv
[
1
]
print
password
#print encodePassword(password)
print
scrambleString
(
password
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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