-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
handle not encoded + in query params, fixes #15
- add debug level, by givein parameter -vv - if the base64 string is not urlencoded, then + will be replaced by a space, what cannot be decoded anymore --> replace spaces back to plus - add test
- Loading branch information
Showing
4 changed files
with
74 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
otpauth-migration://offline?data=ClEKFAciUeGF4aS6IDCvMv99ySZ1ekKsEiVTZXJlbml0eUxhYnM6dGVzdDFAc2VyZW5pdHlsYWJzLmNvLnVrGgxTZXJlbml0eUxhYnMgASgBMAIKUQoUkIY8/fbrHZWTb4CBln18lvqt0HcSJVNlcmVuaXR5TGFiczp0ZXN0MkBzZXJlbml0eWxhYnMuY28udWsaDFNlcmVuaXR5TGFicyABKAEwAgpRChScf+1/Ua4d4gCY0W/7fj9VBkM9PBIlU2VyZW5pdHlMYWJzOnRlc3QzQHNlcmVuaXR5bGFicy5jby51axoMU2VyZW5pdHlMYWJzIAEoATACClEKFG6Qu0ryTSFA/l5rmvTIXtNeb5LtEiVTZXJlbml0eUxhYnM6dGVzdDRAc2VyZW5pdHlsYWJzLmNvLnVrGgxTZXJlbml0eUxhYnMgASgBMAIQARgBIAAogtTa1vz/////AQ== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,6 +88,39 @@ def test_extract_stdout(capsys): | |
assert captured.err == '' | ||
|
||
|
||
def test_extract_not_encoded_plus(capsys): | ||
# Act | ||
extract_otp_secret_keys.main(['test/test_plus_problem_export.txt']) | ||
|
||
# Assert | ||
captured = capsys.readouterr() | ||
|
||
expected_stdout = '''Name: SerenityLabs:[email protected] | ||
Secret: A4RFDYMF4GSLUIBQV4ZP67OJEZ2XUQVM | ||
Issuer: SerenityLabs | ||
Type: OTP_TOTP | ||
Name: SerenityLabs:[email protected] | ||
Secret: SCDDZ7PW5MOZLE3PQCAZM7L4S35K3UDX | ||
Issuer: SerenityLabs | ||
Type: OTP_TOTP | ||
Name: SerenityLabs:[email protected] | ||
Secret: TR76272RVYO6EAEY2FX7W7R7KUDEGPJ4 | ||
Issuer: SerenityLabs | ||
Type: OTP_TOTP | ||
Name: SerenityLabs:[email protected] | ||
Secret: N2ILWSXSJUQUB7S6NONPJSC62NPG7EXN | ||
Issuer: SerenityLabs | ||
Type: OTP_TOTP | ||
''' | ||
|
||
assert captured.out == expected_stdout | ||
assert captured.err == '' | ||
|
||
|
||
def test_extract_printqr(capsys): | ||
# Act | ||
extract_otp_secret_keys.main(['-p', 'example_export.txt']) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,6 +95,35 @@ def test_extract_stdout_2(self): | |
Issuer: raspberrypi | ||
Type: OTP_TOTP | ||
''' | ||
self.assertEqual(actual_output, expected_output) | ||
|
||
def test_extract_not_encoded_plus(self): | ||
out = io.StringIO() | ||
with redirect_stdout(out): | ||
extract_otp_secret_keys.main(['test/test_plus_problem_export.txt']) | ||
actual_output = out.getvalue() | ||
|
||
expected_output = '''Name: SerenityLabs:[email protected] | ||
Secret: A4RFDYMF4GSLUIBQV4ZP67OJEZ2XUQVM | ||
Issuer: SerenityLabs | ||
Type: OTP_TOTP | ||
Name: SerenityLabs:[email protected] | ||
Secret: SCDDZ7PW5MOZLE3PQCAZM7L4S35K3UDX | ||
Issuer: SerenityLabs | ||
Type: OTP_TOTP | ||
Name: SerenityLabs:[email protected] | ||
Secret: TR76272RVYO6EAEY2FX7W7R7KUDEGPJ4 | ||
Issuer: SerenityLabs | ||
Type: OTP_TOTP | ||
Name: SerenityLabs:[email protected] | ||
Secret: N2ILWSXSJUQUB7S6NONPJSC62NPG7EXN | ||
Issuer: SerenityLabs | ||
Type: OTP_TOTP | ||
''' | ||
self.assertEqual(actual_output, expected_output) | ||
|
||
|