path
stringlengths 9
117
| type
stringclasses 2
values | project
stringclasses 10
values | commit_hash
stringlengths 40
40
| commit_message
stringlengths 1
137
| ground_truth
stringlengths 0
2.74k
| main_code
stringlengths 102
3.37k
| context
stringlengths 0
14.7k
|
---|---|---|---|---|---|---|---|
tests.test_click/test_asin
|
Modified
|
bee-san~pyWhat
|
a40757bcb0b372b144e29f424e7eb07023897cc9
|
Merge branch 'main' into bug-fixes-cleanup
|
<1>:<add> result = runner.invoke(main, ["-db", "fixtures/file"])
<del> result = runner.invoke(main, ["fixtures/file"])
|
# module: tests.test_click
def test_asin():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["fixtures/file"])
<2> assert result.exit_code == 0
<3> assert re.findall("ASIN", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
===========changed ref 0===========
# module: tests.test_click
def test_ssh_ed25519_key():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("SSH ED25519", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_ssh_ecdsa_key():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("SSH ECDSA", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_ssh_rsa_key():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("SSH RSA", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_only_text():
runner = CliRunner()
+ result = runner.invoke(main, ["-o", "-db", "fixtures/file"])
- result = runner.invoke(main, ["-o", "fixtures/file"])
assert result.exit_code == 0
assert "Nothing found" in result.output
===========changed ref 4===========
# module: tests.test_click
def test_file_fixture_xmr():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Monero", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_file_fixture_xrp2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("xrpscan", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_file_fixture_xrp():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Ripple", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_file_fixture_bch():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Bitcoin Cash", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_file_fixture_ltc2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("live.block", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_file_fixture_ltc():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Litecoin", str(result.output))
===========changed ref 10===========
# module: tests.test_click
def test_file_fixture_ssn():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Social", str(result.output))
===========changed ref 11===========
# module: tests.test_click
@pytest.mark.skip("Key:value turned off")
def test_file_pcap():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/FollowTheLeader.pcap"])
- result = runner.invoke(main, ["fixtures/FollowTheLeader.pcap"])
assert result.exit_code == 0
assert re.findall("Host:", str(result.output))
===========changed ref 12===========
# module: tests.test_click
def test_file_fixture_youtube_id():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("YouTube", str(result.output))
===========changed ref 13===========
# module: tests.test_click
def test_file_fixture_youtube():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("YouTube", str(result.output))
===========changed ref 14===========
# module: tests.test_click
def test_file_fixture_email():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Email", str(result.output))
===========changed ref 15===========
# module: tests.test_click
@pytest.mark.skip("Key:value turned off")
def test_file_fixture_usernamepassword():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Key", str(result.output))
|
tests.test_click/test_mac
|
Modified
|
bee-san~pyWhat
|
a40757bcb0b372b144e29f424e7eb07023897cc9
|
Merge branch 'main' into bug-fixes-cleanup
|
<1>:<add> result = runner.invoke(main, ["-db", "fixtures/file"])
<del> result = runner.invoke(main, ["fixtures/file"])
|
# module: tests.test_click
def test_mac():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["fixtures/file"])
<2> assert result.exit_code == 0
<3> assert re.findall("de:ad:be:ef:ca:fe", str(result.output))
<4> assert re.findall("DE:AD:BE:EF:CA:FE", str(result.output))
<5>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
===========changed ref 0===========
# module: tests.test_click
def test_asin():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ASIN", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_ssh_ed25519_key():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("SSH ED25519", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_ssh_ecdsa_key():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("SSH ECDSA", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_ssh_rsa_key():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("SSH RSA", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_only_text():
runner = CliRunner()
+ result = runner.invoke(main, ["-o", "-db", "fixtures/file"])
- result = runner.invoke(main, ["-o", "fixtures/file"])
assert result.exit_code == 0
assert "Nothing found" in result.output
===========changed ref 5===========
# module: tests.test_click
def test_file_fixture_xmr():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Monero", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_file_fixture_xrp2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("xrpscan", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_file_fixture_xrp():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Ripple", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_file_fixture_bch():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Bitcoin Cash", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_file_fixture_ltc2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("live.block", str(result.output))
===========changed ref 10===========
# module: tests.test_click
def test_file_fixture_ltc():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Litecoin", str(result.output))
===========changed ref 11===========
# module: tests.test_click
def test_file_fixture_ssn():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Social", str(result.output))
===========changed ref 12===========
# module: tests.test_click
@pytest.mark.skip("Key:value turned off")
def test_file_pcap():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/FollowTheLeader.pcap"])
- result = runner.invoke(main, ["fixtures/FollowTheLeader.pcap"])
assert result.exit_code == 0
assert re.findall("Host:", str(result.output))
===========changed ref 13===========
# module: tests.test_click
def test_file_fixture_youtube_id():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("YouTube", str(result.output))
===========changed ref 14===========
# module: tests.test_click
def test_file_fixture_youtube():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("YouTube", str(result.output))
===========changed ref 15===========
# module: tests.test_click
def test_file_fixture_email():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Email", str(result.output))
|
tests.test_click/test_mac_tags
|
Modified
|
bee-san~pyWhat
|
a40757bcb0b372b144e29f424e7eb07023897cc9
|
Merge branch 'main' into bug-fixes-cleanup
|
<3>:<add> ["--include", "Identifiers,Networking", "-db", "fixtures/file"],
<del> ["--include", "Identifiers,Networking", "fixtures/file"],
|
# module: tests.test_click
def test_mac_tags():
<0> runner = CliRunner()
<1> result = runner.invoke(
<2> main,
<3> ["--include", "Identifiers,Networking", "fixtures/file"],
<4> )
<5> assert result.exit_code == 0
<6> assert "Ethernet" in result.output
<7> assert "IP" in result.output
<8>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
===========changed ref 0===========
# module: tests.test_click
def test_asin():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ASIN", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_ssh_ed25519_key():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("SSH ED25519", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_ssh_ecdsa_key():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("SSH ECDSA", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_ssh_rsa_key():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("SSH RSA", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_mac():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("de:ad:be:ef:ca:fe", str(result.output))
assert re.findall("DE:AD:BE:EF:CA:FE", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_only_text():
runner = CliRunner()
+ result = runner.invoke(main, ["-o", "-db", "fixtures/file"])
- result = runner.invoke(main, ["-o", "fixtures/file"])
assert result.exit_code == 0
assert "Nothing found" in result.output
===========changed ref 6===========
# module: tests.test_click
def test_file_fixture_xmr():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Monero", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_file_fixture_xrp2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("xrpscan", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_file_fixture_xrp():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Ripple", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_file_fixture_bch():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Bitcoin Cash", str(result.output))
===========changed ref 10===========
# module: tests.test_click
def test_file_fixture_ltc2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("live.block", str(result.output))
===========changed ref 11===========
# module: tests.test_click
def test_file_fixture_ltc():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Litecoin", str(result.output))
===========changed ref 12===========
# module: tests.test_click
def test_file_fixture_ssn():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Social", str(result.output))
===========changed ref 13===========
# module: tests.test_click
@pytest.mark.skip("Key:value turned off")
def test_file_pcap():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/FollowTheLeader.pcap"])
- result = runner.invoke(main, ["fixtures/FollowTheLeader.pcap"])
assert result.exit_code == 0
assert re.findall("Host:", str(result.output))
===========changed ref 14===========
# module: tests.test_click
def test_file_fixture_youtube_id():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("YouTube", str(result.output))
===========changed ref 15===========
# module: tests.test_click
def test_file_fixture_youtube():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("YouTube", str(result.output))
===========changed ref 16===========
# module: tests.test_click
def test_file_fixture_email():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Email", str(result.output))
|
tests.test_click/test_pgp_public_key
|
Modified
|
bee-san~pyWhat
|
a40757bcb0b372b144e29f424e7eb07023897cc9
|
Merge branch 'main' into bug-fixes-cleanup
|
<1>:<add> result = runner.invoke(main, ["-db", "fixtures/file"])
<del> result = runner.invoke(main, ["fixtures/file"])
|
# module: tests.test_click
def test_pgp_public_key():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["fixtures/file"])
<2> assert result.exit_code == 0
<3> assert re.findall("PGP Public Key", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
===========changed ref 0===========
# module: tests.test_click
def test_asin():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ASIN", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_mac_tags():
runner = CliRunner()
result = runner.invoke(
main,
+ ["--include", "Identifiers,Networking", "-db", "fixtures/file"],
- ["--include", "Identifiers,Networking", "fixtures/file"],
)
assert result.exit_code == 0
assert "Ethernet" in result.output
assert "IP" in result.output
===========changed ref 2===========
# module: tests.test_click
def test_ssh_ed25519_key():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("SSH ED25519", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_ssh_ecdsa_key():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("SSH ECDSA", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_ssh_rsa_key():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("SSH RSA", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_mac():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("de:ad:be:ef:ca:fe", str(result.output))
assert re.findall("DE:AD:BE:EF:CA:FE", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_only_text():
runner = CliRunner()
+ result = runner.invoke(main, ["-o", "-db", "fixtures/file"])
- result = runner.invoke(main, ["-o", "fixtures/file"])
assert result.exit_code == 0
assert "Nothing found" in result.output
===========changed ref 7===========
# module: tests.test_click
def test_file_fixture_xmr():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Monero", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_file_fixture_xrp2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("xrpscan", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_file_fixture_xrp():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Ripple", str(result.output))
===========changed ref 10===========
# module: tests.test_click
def test_file_fixture_bch():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Bitcoin Cash", str(result.output))
===========changed ref 11===========
# module: tests.test_click
def test_file_fixture_ltc2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("live.block", str(result.output))
===========changed ref 12===========
# module: tests.test_click
def test_file_fixture_ltc():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Litecoin", str(result.output))
===========changed ref 13===========
# module: tests.test_click
def test_file_fixture_ssn():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Social", str(result.output))
===========changed ref 14===========
# module: tests.test_click
@pytest.mark.skip("Key:value turned off")
def test_file_pcap():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/FollowTheLeader.pcap"])
- result = runner.invoke(main, ["fixtures/FollowTheLeader.pcap"])
assert result.exit_code == 0
assert re.findall("Host:", str(result.output))
===========changed ref 15===========
# module: tests.test_click
def test_file_fixture_youtube_id():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("YouTube", str(result.output))
|
tests.test_click/test_pgp_private_key
|
Modified
|
bee-san~pyWhat
|
a40757bcb0b372b144e29f424e7eb07023897cc9
|
Merge branch 'main' into bug-fixes-cleanup
|
<1>:<add> result = runner.invoke(main, ["-db", "fixtures/file"])
<del> result = runner.invoke(main, ["fixtures/file"])
|
# module: tests.test_click
def test_pgp_private_key():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["fixtures/file"])
<2> assert result.exit_code == 0
<3> assert re.findall("PGP Private Key", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
===========changed ref 0===========
# module: tests.test_click
def test_pgp_public_key():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("PGP Public Key", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_asin():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ASIN", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_mac_tags():
runner = CliRunner()
result = runner.invoke(
main,
+ ["--include", "Identifiers,Networking", "-db", "fixtures/file"],
- ["--include", "Identifiers,Networking", "fixtures/file"],
)
assert result.exit_code == 0
assert "Ethernet" in result.output
assert "IP" in result.output
===========changed ref 3===========
# module: tests.test_click
def test_ssh_ed25519_key():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("SSH ED25519", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_ssh_ecdsa_key():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("SSH ECDSA", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_ssh_rsa_key():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("SSH RSA", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_mac():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("de:ad:be:ef:ca:fe", str(result.output))
assert re.findall("DE:AD:BE:EF:CA:FE", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_only_text():
runner = CliRunner()
+ result = runner.invoke(main, ["-o", "-db", "fixtures/file"])
- result = runner.invoke(main, ["-o", "fixtures/file"])
assert result.exit_code == 0
assert "Nothing found" in result.output
===========changed ref 8===========
# module: tests.test_click
def test_file_fixture_xmr():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Monero", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_file_fixture_xrp2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("xrpscan", str(result.output))
===========changed ref 10===========
# module: tests.test_click
def test_file_fixture_xrp():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Ripple", str(result.output))
===========changed ref 11===========
# module: tests.test_click
def test_file_fixture_bch():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Bitcoin Cash", str(result.output))
===========changed ref 12===========
# module: tests.test_click
def test_file_fixture_ltc2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("live.block", str(result.output))
===========changed ref 13===========
# module: tests.test_click
def test_file_fixture_ltc():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Litecoin", str(result.output))
===========changed ref 14===========
# module: tests.test_click
def test_file_fixture_ssn():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Social", str(result.output))
===========changed ref 15===========
# module: tests.test_click
@pytest.mark.skip("Key:value turned off")
def test_file_pcap():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/FollowTheLeader.pcap"])
- result = runner.invoke(main, ["fixtures/FollowTheLeader.pcap"])
assert result.exit_code == 0
assert re.findall("Host:", str(result.output))
|
pywhat.printer/Printing.pretty_print
|
Modified
|
bee-san~pyWhat
|
a40757bcb0b372b144e29f424e7eb07023897cc9
|
Merge branch 'main' into bug-fixes-cleanup
|
<2>:<add> if text["File Signatures"]:
<del> if text["File Signatures"] and text["Regexes"]:
<22>:<add>
<del>
|
# module: pywhat.printer
class Printing:
def pretty_print(self, text: dict, text_input):
<0> to_out = ""
<1>
<2> if text["File Signatures"] and text["Regexes"]:
<3> for key, value in text["File Signatures"].items():
<4> if value:
<5> to_out += "\n"
<6> to_out += f"[bold #D7Afff]File Identified[/bold #D7Afff]: [bold]{key}[/bold] with Magic Numbers {value['ISO 8859-1']}."
<7> to_out += f"\n[bold #D7Afff]File Description: [/bold #D7Afff] {value['Description']}."
<8> to_out += "\n\n"
<9>
<10> if text["Regexes"]:
<11> to_out += "\n[bold #D7Afff]Possible Identification[/bold #D7Afff]\n"
<12> table = Table(
<13> show_header=True, header_style="bold #D7Afff", show_lines=True
<14> )
<15> table.add_column("Matched Text", overflow="fold")
<16> table.add_column("Identified as", overflow="fold")
<17> table.add_column("Description", overflow="fold")
<18>
<19> if self._check_if_directory(text_input):
<20> # if input is a folder, add a filename column
<21> table.add_column("File", overflow="fold")
<22>
<23> # Check if there are any bug bounties with exploits
<24> # in the regex
<25> self._check_if_exploit_in_json(text)
<26> if self.bug_bounty_mode:
<27> table.add_column("Exploit", overflow="fold")
<28>
<29> for key, value in text["Regexes"].items():
<30> for i in value:
<31> matched = i["Matched"]
<32> name = i["Regex Pattern"]["Name"]
<33> description = None
<34> filename = key
<35> exploit = None
<36>
<37> </s>
|
===========below chunk 0===========
# module: pywhat.printer
class Printing:
def pretty_print(self, text: dict, text_input):
# offset: 1
description = (
"Click here to analyse in the browser\n"
+ i["Regex Pattern"]["URL"]
+ matched.replace(" ", "")
)
if i["Regex Pattern"]["Description"]:
if description:
description = (
description + "\n" + i["Regex Pattern"]["Description"]
)
else:
description = i["Regex Pattern"]["Description"]
if "Exploit" in i["Regex Pattern"] and i["Regex Pattern"]["Exploit"]:
exploit = i["Regex Pattern"]["Exploit"]
if not description:
description = "None"
#FIXME this is quite messy
if self.bug_bounty_mode:
if self._check_if_directory(text_input):
table.add_row(
matched,
name,
description,
filename,
exploit,
)
else:
table.add_row(
matched,
name,
description,
exploit,
)
else:
if self._check_if_directory(text_input):
table.add_row(
matched,
name,
description,
filename,
)
else:
table.add_row(
matched,
name,
description,
)
self.console.print(to_out, table)
if to_out == "":
self.console.print("Nothing found!")
===========unchanged ref 0===========
at: pywhat.printer.Printing
_check_if_exploit_in_json(text: dict) -> bool
_check_if_directory(text_input)
at: pywhat.printer.Printing.__init__
self.bug_bounty_mode = False
at: pywhat.printer.Printing._check_if_exploit_in_json
self.bug_bounty_mode = True
===========changed ref 0===========
# module: pywhat
+ def __dir__():
+ return _contents + ["__version__"]
+
===========changed ref 1===========
# module: tests.test_click
def test_json_printing3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file", "--json"])
- result = runner.invoke(main, ["fixtures/file", "--json"])
assert json.loads(result.output.replace("\n", ""))
===========changed ref 2===========
# module: tests.test_click
def test_file_fixture2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert "Dogecoin" in result.output
===========changed ref 3===========
# module: tests.test_click
def test_file_fixture_ssn():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Social", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_file_fixture_email():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Email", str(result.output))
===========changed ref 5===========
# module: tests.test_click
@pytest.mark.skip("Key:value turned off")
def test_file_fixture_usernamepassword():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Key", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_file_fixture_discover():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Discover", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_file_fixture8():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("URL", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_asin():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ASIN", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_ssh_rsa_key():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("SSH RSA", str(result.output))
===========changed ref 10===========
# module: tests.test_click
def test_file_fixture_xmr():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Monero", str(result.output))
===========changed ref 11===========
# module: tests.test_click
def test_file_fixture_xrp():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Ripple", str(result.output))
===========changed ref 12===========
# module: tests.test_click
def test_file_fixture_youtube_id():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("YouTube", str(result.output))
===========changed ref 13===========
# module: tests.test_click
def test_file_fixture_youtube():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("YouTube", str(result.output))
===========changed ref 14===========
# module: tests.test_click
def test_file_fixture_master_card():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("MasterCard", str(result.output))
|
pywhat.what/main
|
Modified
|
bee-san~pyWhat
|
fea7e8aba645193d2c71acc46c3a2a62cbe6e83b
|
Merge branch 'main' into 153-add-pipeline-support
|
<s>=True,
callback=print_version,
help="Display the version of pywhat.",
)
@click.option(
"-if",
"--include-filenames",
is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
help="--format json for json output. --format pretty for a pretty table output.",
)
def main(**kwargs):
<0> """
<1> pyWhat - Identify what something is.
<2>
<3> Made by Bee https://twitter.com/bee_sec_san
<4>
<5> https://github.com/bee-san
<6>
<7> Filtration:
<8>
<9> --rarity min:max
<10>
<11> Rarity is how unlikely something is to be a false-positive. The higher the number, the more unlikely.
<12>
<13> Only print entries with rarity in range [min,max]. min and max can be omitted.
<14>
<15> Note: PyWhat by default has a rarity of 0.1. To see all matches, with many potential false positives use `0:`.
<16>
<17> --include list
<18>
<19> Only include entries containing at least one tag in a list. List is a comma separated list.
<20>
<21> --exclude list
<22>
<23> Exclude specified tags. List is a comma separated list.
<24>
<25> Sorting:
<26>
<27> --key key_name
<28>
<29> Sort by the given key.
<30>
<31> --reverse
<32>
<33> Sort in reverse order.
<34>
<35> Available keys:
<36>
<37> name - Sort by the name of regex pattern
<38>
<39> rarity - Sort by rarity
<40>
<41> matched - Sort by a matched string
<42>
<43> none - No sorting is done (the default)
<44>
<45> Exporting:
<46>
</s>
|
===========below chunk 0===========
<s> callback=print_version,
help="Display the version of pywhat.",
)
@click.option(
"-if",
"--include-filenames",
is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
help="--format json for json output. --format pretty for a pretty table output.",
)
def main(**kwargs):
# offset: 1
Return results in json format.
Boundaryless mode:
CLI tool matches strings like 'abcdTHM{hello}plze' by default because the boundaryless mode is enabled for regexes with a rarity of 0.1 and higher.
Since boundaryless mode may produce a lot of false-positive matches, it is possible to disable it, either fully or partially.
'--disable-boundaryless' flag can be used to fully disable this mode.
In addition, '-br', '-bi', and '-be' options can be used to tweak which regexes should be in boundaryless mode.
Refer to the Filtration section for more information.
Examples:
* what 'HTB{this is a flag}'
* what '0x52908400098527886E0F7030069857D2E4169EE7'
* what -- '52.6169586, -1.9779857'
* what --rarity 0.6: '[email protected]'
* what --rarity 0: --include "credentials, username, password" --exclude "aws, credentials" 'James:SecretPassword'
* what -br 0.6: -be URL '[email protected]'
Your text must either be in quotation marks, or use the POSIX standard of "--" to mean "anything after -- is textual input".
pyWhat can also search files or</s>
===========below chunk 1===========
<s> callback=print_version,
help="Display the version of pywhat.",
)
@click.option(
"-if",
"--include-filenames",
is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
help="--format json for json output. --format pretty for a pretty table output.",
)
def main(**kwargs):
# offset: 2
<s> POSIX standard of "--" to mean "anything after -- is textual input".
pyWhat can also search files or even a whole directory with recursion:
* what 'secret.txt'
* what 'this/is/a/path'
"""
dist = Distribution(
create_filter(kwargs["rarity"], kwargs["include"], kwargs["exclude"])
)
if kwargs["disable_boundaryless"]:
boundaryless = Filter({"Tags": []}) # use empty filter
else:
boundaryless = create_filter(
kwargs["boundaryless_rarity"],
kwargs["boundaryless_include"],
kwargs["boundaryless_exclude"],
)
what_obj = What_Object(dist)
if kwargs["key"] is None:
key = Keys.NONE
else:
try:
key = str_to_key(kwargs["key"])
except ValueError:
print("Invalid key")
sys.exit(1)
identified_output = what_obj.what_is_this(
kwargs["text_input"],
kwargs["only_text"],
key,
kwargs["reverse"],
boundaryless,
kwargs["include_filenames"],
)
p = printer.Printing</s>
===========below chunk 2===========
<s> callback=print_version,
help="Display the version of pywhat.",
)
@click.option(
"-if",
"--include-filenames",
is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
help="--format json for json output. --format pretty for a pretty table output.",
)
def main(**kwargs):
# offset: 3
<s>
if kwargs["json"] or kwargs["format"] == "json":
p.print_json(identified_output)
elif kwargs["format"] == "pretty":
p.pretty_print(identified_output, kwargs["text_input"])
else:
p.print_raw(identified_output, kwargs["text_input"])
===========unchanged ref 0===========
at: click.decorators
command(name: Optional[str]=..., cls: Optional[Type[Command]]=..., context_settings: Optional[Dict[Any, Any]]=..., help: Optional[str]=..., epilog: Optional[str]=..., short_help: Optional[str]=..., options_metavar: str=..., add_help_option: bool=..., hidden: bool=..., deprecated: bool=...) -> Callable[[Callable[..., Any]], Command]
argument(*param_decls: Text, cls: Type[Argument]=..., required: Optional[bool]=..., type: Optional[_ConvertibleType]=..., default: Optional[Any]=..., callback: Optional[_Callback]=..., nargs: Optional[int]=..., metavar: Optional[str]=..., expose_value: bool=..., is_eager: bool=..., envvar: Optional[Union[str, List[str]]]=..., autocompletion: Optional[Callable[[Any, List[str], str], List[Union[str, Tuple[str, str]]]]]=...) -> _IdentityFunction
===========unchanged ref 1===========
option(*param_decls: str, cls: Type[Option]=..., show_default: Union[bool, Text]=..., prompt: Union[bool, Text]=..., confirmation_prompt: bool=..., hide_input: bool=..., is_flag: Optional[bool]=..., flag_value: Optional[Any]=..., multiple: bool=..., count: bool=..., allow_from_autoenv: bool=..., type: _T=..., help: Optional[str]=..., show_choices: bool=..., default: Optional[Any]=..., required: bool=..., callback: Optional[Callable[[Context, Union[Option, Parameter], Union[bool, int, str]], _T]]=..., nargs: Optional[int]=..., metavar: Optional[str]=..., expose_value: bool=..., is_eager: bool=..., envvar: Optional[Union[str, List[str]]]=..., **kwargs: Any) -> _IdentityFunction
option(*param_decls: str, cls: Type[Option]=..., show_default: Union[bool, Text]=..., prompt: Union[bool, Text]=..., confirmation_prompt: bool=..., hide_input: bool=..., is_flag: Optional[bool]=..., flag_value: Optional[Any]=..., multiple: bool=..., count: bool=..., allow_from_autoenv: bool=..., type: Type[int]=..., help: Optional[str]=..., show_choices: bool=..., default: Optional[Any]=..., required: bool=..., callback: Callable[[Context, Union[Option, Parameter], int], Any]=..., nargs: Optional[int]=..., metavar: Optional[str]=..., expose_value: bool=..., is_eager: bool=..., envvar: Optional[Union[str, List[str]]]=..., **kwargs: Any) -> _IdentityFunction
option(*param_decls: Text, cls: Type[Option]=..., show_default: Union[bool, Text]=..., prompt: Union[bool, Text]=..., confirmation_prompt: bool=...,</s>
|
|
pywhat.printer/Printing.pretty_print
|
Modified
|
bee-san~pyWhat
|
fea7e8aba645193d2c71acc46c3a2a62cbe6e83b
|
Merge branch 'main' into 153-add-pipeline-support
|
# module: pywhat.printer
class Printing:
def pretty_print(self, text: dict, text_input):
<0> to_out = ""
<1>
<2> if text["File Signatures"]:
<3> for key, value in text["File Signatures"].items():
<4> if value:
<5> to_out += "\n"
<6> to_out += f"[bold #D7Afff]File Identified[/bold #D7Afff]: [bold]{key}[/bold] with Magic Numbers {value['ISO 8859-1']}."
<7> to_out += f"\n[bold #D7Afff]File Description: [/bold #D7Afff] {value['Description']}."
<8> to_out += "\n\n"
<9>
<10> if text["Regexes"]:
<11> to_out += "\n[bold #D7Afff]Possible Identification[/bold #D7Afff]\n"
<12> table = Table(
<13> show_header=True, header_style="bold #D7Afff", show_lines=True
<14> )
<15> table.add_column("Matched Text", overflow="fold")
<16> table.add_column("Identified as", overflow="fold")
<17> table.add_column("Description", overflow="fold")
<18>
<19> if self._check_if_directory(text_input):
<20> # if input is a folder, add a filename column
<21> table.add_column("File", overflow="fold")
<22>
<23> # Check if there are any bug bounties with exploits
<24> # in the regex
<25> self._check_if_exploit_in_json(text)
<26> if self.bug_bounty_mode:
<27> table.add_column("Exploit", overflow="fold")
<28>
<29> for key, value in text["Regexes"].items():
<30> for i in value:
<31> matched = i["Matched"]
<32> name = i["Regex Pattern"]["Name"]
<33> description = None
<34> filename = key
<35> exploit = None
<36>
<37> if "URL" in i["</s>
|
===========below chunk 0===========
# module: pywhat.printer
class Printing:
def pretty_print(self, text: dict, text_input):
# offset: 1
description = (
"Click here to analyse in the browser\n"
+ i["Regex Pattern"]["URL"]
+ matched.replace(" ", "")
)
if i["Regex Pattern"]["Description"]:
if description:
description = (
description + "\n" + i["Regex Pattern"]["Description"]
)
else:
description = i["Regex Pattern"]["Description"]
if (
"Exploit" in i["Regex Pattern"]
and i["Regex Pattern"]["Exploit"]
):
exploit = i["Regex Pattern"]["Exploit"]
if not description:
description = "None"
# FIXME this is quite messy
if self.bug_bounty_mode:
if self._check_if_directory(text_input):
table.add_row(
matched,
name,
description,
filename,
exploit,
)
else:
table.add_row(
matched,
name,
description,
exploit,
)
else:
if self._check_if_directory(text_input):
table.add_row(
matched,
name,
description,
filename,
)
else:
table.add_row(
matched,
name,
description,
)
self.console.print(to_out.lstrip(), table)
else:
self.console.print((to_out + "\nNothing found!").lstrip())
===========unchanged ref 0===========
at: pywhat.printer.Printing
_check_if_exploit_in_json(text: dict) -> bool
_check_if_directory(text_input)
at: pywhat.printer.Printing.__init__
self.bug_bounty_mode = False
at: pywhat.printer.Printing._check_if_exploit_in_json
self.bug_bounty_mode = True
===========changed ref 0===========
# module: pywhat.what
+
+
+ def get_text(ctx, opts, value):
+ if not value and not click.get_text_stream("stdin").isatty():
+ return click.get_text_stream("stdin").read().strip()
+ return value
+
===========changed ref 1===========
<s>=True,
callback=print_version,
help="Display the version of pywhat.",
)
@click.option(
"-if",
"--include-filenames",
is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
help="--format json for json output. --format pretty for a pretty table output.",
)
def main(**kwargs):
"""
pyWhat - Identify what something is.
Made by Bee https://twitter.com/bee_sec_san
https://github.com/bee-san
Filtration:
--rarity min:max
Rarity is how unlikely something is to be a false-positive. The higher the number, the more unlikely.
Only print entries with rarity in range [min,max]. min and max can be omitted.
Note: PyWhat by default has a rarity of 0.1. To see all matches, with many potential false positives use `0:`.
--include list
Only include entries containing at least one tag in a list. List is a comma separated list.
--exclude list
Exclude specified tags. List is a comma separated list.
Sorting:
--key key_name
Sort by the given key.
--reverse
Sort in reverse order.
Available keys:
name - Sort by the name of regex pattern
rarity - Sort by rarity
matched - Sort by a matched string
none - No sorting is done (the default)
Exporting:
--json
Return results in json format.
Boundaryless mode:
CLI tool matches strings like 'abcdTHM{hello}plze' by default because</s>
===========changed ref 2===========
<s> callback=print_version,
help="Display the version of pywhat.",
)
@click.option(
"-if",
"--include-filenames",
is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
help="--format json for json output. --format pretty for a pretty table output.",
)
def main(**kwargs):
# offset: 1
<s>
Boundaryless mode:
CLI tool matches strings like 'abcdTHM{hello}plze' by default because the boundaryless mode is enabled for regexes with a rarity of 0.1 and higher.
Since boundaryless mode may produce a lot of false-positive matches, it is possible to disable it, either fully or partially.
'--disable-boundaryless' flag can be used to fully disable this mode.
In addition, '-br', '-bi', and '-be' options can be used to tweak which regexes should be in boundaryless mode.
Refer to the Filtration section for more information.
Examples:
* what 'HTB{this is a flag}'
* what '0x52908400098527886E0F7030069857D2E4169EE7'
* what -- '52.6169586, -1.9779857'
* what --rarity 0.6: '[email protected]'
* what --rarity 0: --include "credentials, username, password" --exclude "aws, credentials" 'James:SecretPassword'
* what -br 0.6: -be URL '[email protected]'
Your text must either be in quotation marks, or use the POSIX standard of "--" to mean "any</s>
|
|
pywhat.printer/Printing.print_raw
|
Modified
|
bee-san~pyWhat
|
fea7e8aba645193d2c71acc46c3a2a62cbe6e83b
|
Merge branch 'main' into 153-add-pipeline-support
|
# module: pywhat.printer
class Printing:
def print_raw(self, text: dict, text_input) -> str:
<0> output_str = ""
<1>
<2> if text["File Signatures"] and text["Regexes"]:
<3> for key, value in text["File Signatures"].items():
<4> if value:
<5> output_str += "\n"
<6> output_str += f"[bold #D7Afff]File Identified[/bold #D7Afff]: [bold]{key}[/bold] with Magic Numbers {value['ISO 8859-1']}."
<7> output_str += f"\n[bold #D7Afff]File Description:[/bold #D7Afff] {value['Description']}."
<8> output_str += "\n"
<9>
<10> if text["Regexes"]:
<11> for key, value in text["Regexes"].items():
<12> for i in value:
<13> description = None
<14> matched = i["Matched"]
<15> if self._check_if_directory(text_input):
<16> output_str += f"[bold #D7Afff]File: {key}[/bold #D7Afff]\n"
<17> output_str += (
<18> "[bold #D7Afff]Matched on: [/bold #D7Afff]" + i["Matched"]
<19> )
<20> output_str += (
<21> "\n[bold #D7Afff]Name: [/bold #D7Afff]"
<22> + i["Regex Pattern"]["Name"]
<23> )
<24>
<25> link = None
<26> if "URL" in i["Regex Pattern"] and i["Regex Pattern"]["URL"]:
<27> link = (
<28> "\n[bold #D7Afff]Link: [/bold #D7Afff] "
<29> + i["Regex Pattern"]["URL"]
<30> + matched.replace(" ", "")
<31> )
<32>
<33> if link:
<34> output_str += link
<35>
<36> if i["Regex Pattern"]["Description"]:
<37> description = (
<38> "\n</s>
|
===========below chunk 0===========
# module: pywhat.printer
class Printing:
def print_raw(self, text: dict, text_input) -> str:
# offset: 1
+ i["Regex Pattern"]["Description"]
)
if description:
output_str += description
if (
"Exploit" in i["Regex Pattern"]
and i["Regex Pattern"]["Exploit"]
):
output_str += (
"\n[bold #D7Afff]Exploit: [/bold #D7Afff]"
+ i["Regex Pattern"]["Exploit"]
)
output_str += "\n\n"
if output_str == "":
self.console.print("Nothing found!")
self.console.print(output_str)
===========unchanged ref 0===========
at: pywhat.printer.Printing
_check_if_directory(text_input)
at: pywhat.printer.Printing.__init__
self.console = Console(highlight=False)
===========changed ref 0===========
# module: pywhat.printer
class Printing:
def pretty_print(self, text: dict, text_input):
to_out = ""
if text["File Signatures"]:
for key, value in text["File Signatures"].items():
if value:
to_out += "\n"
to_out += f"[bold #D7Afff]File Identified[/bold #D7Afff]: [bold]{key}[/bold] with Magic Numbers {value['ISO 8859-1']}."
to_out += f"\n[bold #D7Afff]File Description: [/bold #D7Afff] {value['Description']}."
to_out += "\n\n"
if text["Regexes"]:
to_out += "\n[bold #D7Afff]Possible Identification[/bold #D7Afff]\n"
table = Table(
show_header=True, header_style="bold #D7Afff", show_lines=True
)
table.add_column("Matched Text", overflow="fold")
table.add_column("Identified as", overflow="fold")
table.add_column("Description", overflow="fold")
if self._check_if_directory(text_input):
# if input is a folder, add a filename column
table.add_column("File", overflow="fold")
# Check if there are any bug bounties with exploits
# in the regex
self._check_if_exploit_in_json(text)
if self.bug_bounty_mode:
table.add_column("Exploit", overflow="fold")
for key, value in text["Regexes"].items():
for i in value:
matched = i["Matched"]
name = i["Regex Pattern"]["Name"]
description = None
filename = key
exploit = None
if "URL" in i["Regex Pattern"] and i["Regex Pattern"]["URL"]:
description = (
"Click here to analyse in the browser\n"
+ i["Regex</s>
===========changed ref 1===========
# module: pywhat.printer
class Printing:
def pretty_print(self, text: dict, text_input):
# offset: 1
<s>"]["URL"]:
description = (
"Click here to analyse in the browser\n"
+ i["Regex Pattern"]["URL"]
+ matched.replace(" ", "")
)
if i["Regex Pattern"]["Description"]:
if description:
description = (
description + "\n" + i["Regex Pattern"]["Description"]
)
else:
description = i["Regex Pattern"]["Description"]
if (
"Exploit" in i["Regex Pattern"]
and i["Regex Pattern"]["Exploit"]
):
exploit = i["Regex Pattern"]["Exploit"]
if not description:
description = "None"
# FIXME this is quite messy
if self.bug_bounty_mode:
if self._check_if_directory(text_input):
table.add_row(
matched,
name,
description,
filename,
exploit,
)
else:
table.add_row(
matched,
name,
description,
exploit,
)
else:
if self._check_if_directory(text_input):
table.add_row(
matched,
name,
description,
filename,
)
else:
table.add_row(
matched,
name,
description,
)
+ self.console.print(to_out.strip(), table)
- self.console.print(to_out.lstrip(), table)
else:
self.console.print((to_out + "\nNothing found!").lstrip())
===========changed ref 2===========
# module: pywhat.what
+
+
+ def get_text(ctx, opts, value):
+ if not value and not click.get_text_stream("stdin").isatty():
+ return click.get_text_stream("stdin").read().strip()
+ return value
+
===========changed ref 3===========
<s>=True,
callback=print_version,
help="Display the version of pywhat.",
)
@click.option(
"-if",
"--include-filenames",
is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
help="--format json for json output. --format pretty for a pretty table output.",
)
def main(**kwargs):
"""
pyWhat - Identify what something is.
Made by Bee https://twitter.com/bee_sec_san
https://github.com/bee-san
Filtration:
--rarity min:max
Rarity is how unlikely something is to be a false-positive. The higher the number, the more unlikely.
Only print entries with rarity in range [min,max]. min and max can be omitted.
Note: PyWhat by default has a rarity of 0.1. To see all matches, with many potential false positives use `0:`.
--include list
Only include entries containing at least one tag in a list. List is a comma separated list.
--exclude list
Exclude specified tags. List is a comma separated list.
Sorting:
--key key_name
Sort by the given key.
--reverse
Sort in reverse order.
Available keys:
name - Sort by the name of regex pattern
rarity - Sort by rarity
matched - Sort by a matched string
none - No sorting is done (the default)
Exporting:
--json
Return results in json format.
Boundaryless mode:
CLI tool matches strings like 'abcdTHM{hello}plze' by default because</s>
|
|
noxfile/tests
|
Modified
|
bee-san~pyWhat
|
7c334d2310261726efb105c8a25312f45d9a7b1a
|
Merge branch 'main' into 106-add-black-isort-tests
|
<2>:<add> install_with_constraints(session, "pytest", "pytest-black", "pytest-isort")
<del> install_with_constraints(session, "pytest")
|
# module: noxfile
@nox.session(python=["3.8", "3.7"])
def tests(session: Session) -> None:
<0> """Run the test suite."""
<1> session.run("poetry", "install", "--no-dev", external=True)
<2> install_with_constraints(session, "pytest")
<3> session.run("pytest")
<4>
|
===========unchanged ref 0===========
at: noxfile
install_with_constraints(session: Session, *args: str, **kwargs: Any) -> None
|
noxfile/typeguard
|
Modified
|
bee-san~pyWhat
|
7c334d2310261726efb105c8a25312f45d9a7b1a
|
Merge branch 'main' into 106-add-black-isort-tests
|
<3>:<add> install_with_constraints(
<add> session, "pytest", "pytest-mock", "typeguard", "pytest-black", "pytest-isort"
<add> )
<del> install_with_constraints(session, "pytest", "pytest-mock", "typeguard")
|
# module: noxfile
@nox.session(python=["3.8", "3.7"])
def typeguard(session: Session) -> None:
<0> """Runtime type checking using Typeguard."""
<1> args = session.posargs or ["-m", "not e2e"]
<2> session.run("poetry", "install", "--no-dev", external=True)
<3> install_with_constraints(session, "pytest", "pytest-mock", "typeguard")
<4> session.run("pytest", f"--typeguard-packages={package}", *args)
<5>
|
===========unchanged ref 0===========
at: noxfile
install_with_constraints(session: Session, *args: str, **kwargs: Any) -> None
===========changed ref 0===========
# module: noxfile
@nox.session(python=["3.8", "3.7"])
def tests(session: Session) -> None:
"""Run the test suite."""
session.run("poetry", "install", "--no-dev", external=True)
+ install_with_constraints(session, "pytest", "pytest-black", "pytest-isort")
- install_with_constraints(session, "pytest")
session.run("pytest")
|
pywhat.printer/Printing.pretty_print
|
Modified
|
bee-san~pyWhat
|
2feeefa6930b9046d5b40760761090181f473718
|
Do not print 'Nothing found!' in bug bounty mode
|
# module: pywhat.printer
class Printing:
def pretty_print(self, text: dict, text_input):
<0> to_out = ""
<1>
<2> if text["File Signatures"]:
<3> for key, value in text["File Signatures"].items():
<4> if value:
<5> to_out += "\n"
<6> to_out += f"[bold #D7Afff]File Identified[/bold #D7Afff]: [bold]{key}[/bold] with Magic Numbers {value['ISO 8859-1']}."
<7> to_out += f"\n[bold #D7Afff]File Description: [/bold #D7Afff] {value['Description']}."
<8> to_out += "\n\n"
<9>
<10> if text["Regexes"]:
<11> to_out += "\n[bold #D7Afff]Possible Identification[/bold #D7Afff]\n"
<12> table = Table(
<13> show_header=True, header_style="bold #D7Afff", show_lines=True
<14> )
<15> table.add_column("Matched Text", overflow="fold")
<16> table.add_column("Identified as", overflow="fold")
<17> table.add_column("Description", overflow="fold")
<18>
<19> if self._check_if_directory(text_input):
<20> # if input is a folder, add a filename column
<21> table.add_column("File", overflow="fold")
<22>
<23> # Check if there are any bug bounties with exploits
<24> # in the regex
<25> self._check_if_exploit_in_json(text)
<26> if self.bug_bounty_mode:
<27> table.add_column("Exploit", overflow="fold")
<28>
<29> for key, value in text["Regexes"].items():
<30> for i in value:
<31> matched = i["Matched"]
<32> name = i["Regex Pattern"]["Name"]
<33> description = None
<34> filename = key
<35> exploit = None
<36>
<37> if "URL" in i["</s>
|
===========below chunk 0===========
# module: pywhat.printer
class Printing:
def pretty_print(self, text: dict, text_input):
# offset: 1
description = (
"Click here to analyse in the browser\n"
+ i["Regex Pattern"]["URL"]
+ matched.replace(" ", "")
)
if i["Regex Pattern"]["Description"]:
if description:
description = (
description + "\n" + i["Regex Pattern"]["Description"]
)
else:
description = i["Regex Pattern"]["Description"]
if (
"Exploit" in i["Regex Pattern"]
and i["Regex Pattern"]["Exploit"]
):
exploit = i["Regex Pattern"]["Exploit"]
if not description:
description = "None"
# FIXME this is quite messy
if self.bug_bounty_mode:
if self._check_if_directory(text_input):
table.add_row(
matched,
name,
description,
filename,
exploit,
)
else:
table.add_row(
matched,
name,
description,
exploit,
)
else:
if self._check_if_directory(text_input):
table.add_row(
matched,
name,
description,
filename,
)
else:
table.add_row(
matched,
name,
description,
)
self.console.print(to_out.strip(), table)
else:
self.console.print((to_out + "\nNothing found!").lstrip())
===========unchanged ref 0===========
at: pywhat.printer.Printing
_check_if_exploit_in_json(text: dict) -> bool
_check_if_directory(text_input)
at: pywhat.printer.Printing.__init__
self.bug_bounty_mode = False
at: pywhat.printer.Printing._check_if_exploit_in_json
self.bug_bounty_mode = True
|
|
pywhat.printer/Printing.print_raw
|
Modified
|
bee-san~pyWhat
|
2feeefa6930b9046d5b40760761090181f473718
|
Do not print 'Nothing found!' in bug bounty mode
|
# module: pywhat.printer
class Printing:
def print_raw(self, text: dict, text_input) -> str:
<0> output_str = ""
<1>
<2> if text["File Signatures"] and text["Regexes"]:
<3> for key, value in text["File Signatures"].items():
<4> if value:
<5> output_str += "\n"
<6> output_str += f"[bold #D7Afff]File Identified[/bold #D7Afff]: [bold]{key}[/bold] with Magic Numbers {value['ISO 8859-1']}."
<7> output_str += f"\n[bold #D7Afff]File Description:[/bold #D7Afff] {value['Description']}."
<8> output_str += "\n"
<9>
<10> if text["Regexes"]:
<11> for key, value in text["Regexes"].items():
<12> for i in value:
<13> description = None
<14> matched = i["Matched"]
<15> if self._check_if_directory(text_input):
<16> output_str += f"[bold #D7Afff]File: {key}[/bold #D7Afff]\n"
<17> output_str += (
<18> "[bold #D7Afff]Matched on: [/bold #D7Afff]" + i["Matched"]
<19> )
<20> output_str += (
<21> "\n[bold #D7Afff]Name: [/bold #D7Afff]"
<22> + i["Regex Pattern"]["Name"]
<23> )
<24>
<25> link = None
<26> if "URL" in i["Regex Pattern"] and i["Regex Pattern"]["URL"]:
<27> link = (
<28> "\n[bold #D7Afff]Link: [/bold #D7Afff] "
<29> + i["Regex Pattern"]["URL"]
<30> + matched.replace(" ", "")
<31> )
<32>
<33> if link:
<34> output_str += link
<35>
<36> if i["Regex Pattern"]["Description"]:
<37> description = (
<38> "\n</s>
|
===========below chunk 0===========
# module: pywhat.printer
class Printing:
def print_raw(self, text: dict, text_input) -> str:
# offset: 1
+ i["Regex Pattern"]["Description"]
)
if description:
output_str += description
if (
"Exploit" in i["Regex Pattern"]
and i["Regex Pattern"]["Exploit"]
):
output_str += (
"\n[bold #D7Afff]Exploit: [/bold #D7Afff]"
+ i["Regex Pattern"]["Exploit"]
)
output_str += "\n\n"
if output_str == "":
self.console.print("Nothing found!")
if output_str.strip():
self.console.print(output_str.rstrip())
===========unchanged ref 0===========
at: pywhat.printer.Printing
_check_if_directory(text_input)
at: pywhat.printer.Printing.__init__
self.console = Console(highlight=False)
self.bug_bounty_mode = False
at: pywhat.printer.Printing._check_if_exploit_in_json
self.bug_bounty_mode = True
===========changed ref 0===========
# module: pywhat.printer
class Printing:
def pretty_print(self, text: dict, text_input):
to_out = ""
if text["File Signatures"]:
for key, value in text["File Signatures"].items():
if value:
to_out += "\n"
to_out += f"[bold #D7Afff]File Identified[/bold #D7Afff]: [bold]{key}[/bold] with Magic Numbers {value['ISO 8859-1']}."
to_out += f"\n[bold #D7Afff]File Description: [/bold #D7Afff] {value['Description']}."
to_out += "\n\n"
if text["Regexes"]:
to_out += "\n[bold #D7Afff]Possible Identification[/bold #D7Afff]\n"
table = Table(
show_header=True, header_style="bold #D7Afff", show_lines=True
)
table.add_column("Matched Text", overflow="fold")
table.add_column("Identified as", overflow="fold")
table.add_column("Description", overflow="fold")
if self._check_if_directory(text_input):
# if input is a folder, add a filename column
table.add_column("File", overflow="fold")
# Check if there are any bug bounties with exploits
# in the regex
self._check_if_exploit_in_json(text)
if self.bug_bounty_mode:
table.add_column("Exploit", overflow="fold")
for key, value in text["Regexes"].items():
for i in value:
matched = i["Matched"]
name = i["Regex Pattern"]["Name"]
description = None
filename = key
exploit = None
if "URL" in i["Regex Pattern"] and i["Regex Pattern"]["URL"]:
description = (
"Click here to analyse in the browser\n"
+ i["Regex</s>
===========changed ref 1===========
# module: pywhat.printer
class Printing:
def pretty_print(self, text: dict, text_input):
# offset: 1
<s>"]["URL"]:
description = (
"Click here to analyse in the browser\n"
+ i["Regex Pattern"]["URL"]
+ matched.replace(" ", "")
)
if i["Regex Pattern"]["Description"]:
if description:
description = (
description + "\n" + i["Regex Pattern"]["Description"]
)
else:
description = i["Regex Pattern"]["Description"]
if (
"Exploit" in i["Regex Pattern"]
and i["Regex Pattern"]["Exploit"]
):
exploit = i["Regex Pattern"]["Exploit"]
if not description:
description = "None"
# FIXME this is quite messy
if self.bug_bounty_mode:
if self._check_if_directory(text_input):
table.add_row(
matched,
name,
description,
filename,
exploit,
)
else:
table.add_row(
matched,
name,
description,
exploit,
)
else:
if self._check_if_directory(text_input):
table.add_row(
matched,
name,
description,
filename,
)
else:
table.add_row(
matched,
name,
description,
)
self.console.print(to_out.strip(), table)
+ elif not self.bug_bounty_mode:
- else:
self.console.print((to_out + "\nNothing found!").lstrip())
|
|
pywhat.regex_identifier/RegexIdentifier.check
|
Modified
|
bee-san~pyWhat
|
fec71ed0a3b2ab4da69bdaaeb7124e7f4fabdfd4
|
Merge branch 'main' into fix_here_replacement
|
<12>:<add> reg_match = copy.deepcopy(reg)
<del> reg = copy.copy(reg)
<15>:<add> if reg_match.get("Exploit") is not None and "curl" in reg_match["Exploit"]:
<del> if reg.get("Exploit") is not None and "curl" in reg["Exploit"]:
<17>:<add> reg_match["Exploit"] = re.sub(
<del> reg["Exploit"] = re.sub(
<18>:<add> r"[A-Z_]+_HERE", matched, reg_match["Exploit"]
<del> r"[A-Z_]+_HERE", matched, reg["Exploit"]
<21>:<add> children = reg_match.get("Children")
<del> children = reg.get("Children")
|
# module: pywhat.regex_identifier
class RegexIdentifier:
def check(
self,
text,
dist: Optional[Distribution] = None,
*,
boundaryless: Optional[Filter] = None
):
<0> if dist is None:
<1> dist = self.distribution
<2> if boundaryless is None:
<3> boundaryless = Filter({"Tags": []})
<4> matches = []
<5>
<6> for string in text:
<7> for reg in dist.get_regexes():
<8> regex = (
<9> reg["Boundaryless Regex"] if reg in boundaryless else reg["Regex"]
<10> )
<11> for matched_regex in re.finditer(regex, string, re.MULTILINE):
<12> reg = copy.copy(reg)
<13> matched = self.clean_text(matched_regex.group(0))
<14>
<15> if reg.get("Exploit") is not None and "curl" in reg["Exploit"]:
<16> # Replace anything like XXXXX_XXXXXX_HERE with the match
<17> reg["Exploit"] = re.sub(
<18> r"[A-Z_]+_HERE", matched, reg["Exploit"]
<19> )
<20>
<21> children = reg.get("Children")
<22> if children is not None:
<23> processed_match = re.sub(
<24> children.get("deletion_pattern", ""), "", matched
<25> )
<26> matched_children = []
<27> if children["method"] == "hashmap":
<28> for length in children["lengths"]:
<29> try:
<30> matched_children.append(
<31> children["Items"][processed_match[:length]]
<32> )
<33> except KeyError:
<34> continue
<35> else:
<36> for element in children["Items"]:
<37> if (
<38> children["method"] == "regex"
<39> and re.search(
<40> element, processed_match, re.MULTILINE
<41> )
<42> ) or (
<43> children["method"] == "startswith"
<44> and processed_match.</s>
|
===========below chunk 0===========
# module: pywhat.regex_identifier
class RegexIdentifier:
def check(
self,
text,
dist: Optional[Distribution] = None,
*,
boundaryless: Optional[Filter] = None
):
# offset: 1
):
matched_children.append(children["Items"][element])
if matched_children:
reg["Description"] = children.get("entry", "") + ", ".join(
matched_children
)
reg.pop("Children", None)
matches.append(
{
"Matched": matched,
"Regex Pattern": reg,
}
)
return matches
===========unchanged ref 0===========
at: copy
deepcopy(x: _T, memo: Optional[Dict[int, Any]]=..., _nil: Any=...) -> _T
at: pywhat.filter
Filter(filters_dict: Optional[Mapping]=None)
Distribution(filter: Optional[Filter]=None)
at: pywhat.filter.Distribution
get_regexes()
at: pywhat.regex_identifier.RegexIdentifier
clean_text(text)
at: pywhat.regex_identifier.RegexIdentifier.__init__
self.distribution = Distribution()
at: re
MULTILINE = RegexFlag.MULTILINE
search(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> Optional[Match[AnyStr]]
search(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> Optional[Match[AnyStr]]
sub(pattern: AnyStr, repl: AnyStr, string: AnyStr, count: int=..., flags: _FlagsType=...) -> AnyStr
sub(pattern: Pattern[AnyStr], repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int=..., flags: _FlagsType=...) -> AnyStr
sub(pattern: AnyStr, repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int=..., flags: _FlagsType=...) -> AnyStr
sub(pattern: Pattern[AnyStr], repl: AnyStr, string: AnyStr, count: int=..., flags: _FlagsType=...) -> AnyStr
finditer(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> Iterator[Match[AnyStr]]
finditer(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> Iterator[Match[AnyStr]]
at: typing.Match
pos: int
endpos: int
lastindex: Optional[int]
lastgroup: Optional[AnyStr]
string: AnyStr
re: Pattern[AnyStr]
===========unchanged ref 1===========
group(group1: Union[str, int], group2: Union[str, int], /, *groups: Union[str, int]) -> Tuple[AnyStr, ...]
group(group: Union[str, int]=..., /) -> AnyStr
|
pywhat.helper/CaseInsensitiveSet.issubset
|
Modified
|
bee-san~pyWhat
|
ac0ffebe26ce659946be08cef4861321a42c4f77
|
added nano; simplify (#168)
|
<0>:<del> for value in self:
<1>:<del> if value not in other:
<2>:<del> return False
<3>:<del> return True
<4>:<add> return all(value in other for value in self)
|
# module: pywhat.helper
class CaseInsensitiveSet(collections.abc.Set):
def issubset(self, other):
<0> for value in self:
<1> if value not in other:
<2> return False
<3> return True
<4>
|
===========unchanged ref 0===========
at: enum
Enum()
|
pywhat.filter/Filter.__init__
|
Modified
|
bee-san~pyWhat
|
ac0ffebe26ce659946be08cef4861321a42c4f77
|
added nano; simplify (#168)
|
<3>:<add> filters_dict = {}
<del> filters_dict = dict()
|
# module: pywhat.filter
class Filter(Mapping):
def __init__(self, filters_dict: Optional[Mapping] = None):
<0> tags = CaseInsensitiveSet(AvailableTags().get_tags())
<1> self._dict = dict()
<2> if filters_dict is None:
<3> filters_dict = dict()
<4>
<5> self._dict["Tags"] = CaseInsensitiveSet(filters_dict.setdefault("Tags", tags))
<6> self._dict["ExcludeTags"] = CaseInsensitiveSet(
<7> filters_dict.setdefault("ExcludeTags", set())
<8> )
<9> # We have regex with 0 rarity which trip false positive alarms all the time
<10> self._dict["MinRarity"] = filters_dict.setdefault("MinRarity", 0.1)
<11> self._dict["MaxRarity"] = filters_dict.setdefault("MaxRarity", 1)
<12> if not self._dict["Tags"].issubset(tags) or not self._dict[
<13> "ExcludeTags"
<14> ].issubset(tags):
<15> raise InvalidTag("Passed filter contains tags that are not used by 'what'")
<16>
|
===========unchanged ref 0===========
at: pywhat.helper
AvailableTags()
InvalidTag(*args: object)
CaseInsensitiveSet(iterable=None)
at: pywhat.helper.AvailableTags
get_tags()
at: typing
Mapping = _alias(collections.abc.Mapping, 2)
===========changed ref 0===========
# module: pywhat.helper
class CaseInsensitiveSet(collections.abc.Set):
def issubset(self, other):
- for value in self:
- if value not in other:
- return False
- return True
+ return all(value in other for value in self)
|
pywhat.filter/Distribution._filter
|
Modified
|
bee-san~pyWhat
|
ac0ffebe26ce659946be08cef4861321a42c4f77
|
added nano; simplify (#168)
|
<1>:<del> temp_regexes = []
<2>:<del> for regex in self._regexes:
<3>:<del> if regex in self:
<4>:<del> temp_regexes.append(regex)
<5>:<del>
<6>:<add> temp_regexes = [regex for regex in self._regexes if regex in self]
|
# module: pywhat.filter
class Distribution(Filter):
def _filter(self):
<0> self._regexes = load_regexes()
<1> temp_regexes = []
<2> for regex in self._regexes:
<3> if regex in self:
<4> temp_regexes.append(regex)
<5>
<6> self._regexes = temp_regexes
<7>
|
===========unchanged ref 0===========
at: pywhat.helper
_lru_cache_wrapper(*args: Hashable, **kwargs: Hashable) -> _T
===========changed ref 0===========
# module: pywhat.filter
class Filter(Mapping):
def __init__(self, filters_dict: Optional[Mapping] = None):
tags = CaseInsensitiveSet(AvailableTags().get_tags())
self._dict = dict()
if filters_dict is None:
+ filters_dict = {}
- filters_dict = dict()
self._dict["Tags"] = CaseInsensitiveSet(filters_dict.setdefault("Tags", tags))
self._dict["ExcludeTags"] = CaseInsensitiveSet(
filters_dict.setdefault("ExcludeTags", set())
)
# We have regex with 0 rarity which trip false positive alarms all the time
self._dict["MinRarity"] = filters_dict.setdefault("MinRarity", 0.1)
self._dict["MaxRarity"] = filters_dict.setdefault("MaxRarity", 1)
if not self._dict["Tags"].issubset(tags) or not self._dict[
"ExcludeTags"
].issubset(tags):
raise InvalidTag("Passed filter contains tags that are not used by 'what'")
===========changed ref 1===========
# module: pywhat.helper
class CaseInsensitiveSet(collections.abc.Set):
def issubset(self, other):
- for value in self:
- if value not in other:
- return False
- return True
+ return all(value in other for value in self)
|
pywhat.identifier/Identifier.__init__
|
Modified
|
bee-san~pyWhat
|
ac0ffebe26ce659946be08cef4861321a42c4f77
|
added nano; simplify (#168)
|
<0>:<add> self.distribution = Distribution() if dist is None else dist
<add> self.boundaryless = (
<add> Filter({"Tags": []}) if boundaryless is None else boundaryless
<del> if dist is None:
<1>:<del> self.distribution = Distribution()
<2>:<add> )
<del> else:
<3>:<del> self.distribution = dist
<7>:<del> if boundaryless is None:
<8>:<del> self.boundaryless = Filter({"Tags": []})
<9>:<del> else:
<10>:<del> self.boundaryless = boundaryless
|
# module: pywhat.identifier
class Identifier:
def __init__(
self,
*,
dist: Optional[Distribution] = None,
key: Callable = Keys.NONE,
reverse=False,
boundaryless: Optional[Filter] = None,
):
<0> if dist is None:
<1> self.distribution = Distribution()
<2> else:
<3> self.distribution = dist
<4> self._regex_id = RegexIdentifier()
<5> self._key = key
<6> self._reverse = reverse
<7> if boundaryless is None:
<8> self.boundaryless = Filter({"Tags": []})
<9> else:
<10> self.boundaryless = boundaryless
<11>
|
===========unchanged ref 0===========
at: pywhat.filter
Filter(filters_dict: Optional[Mapping]=None)
Distribution(filter: Optional[Filter]=None)
at: pywhat.helper
Keys()
at: pywhat.regex_identifier
RegexIdentifier()
at: typing
Callable = _CallableType(collections.abc.Callable, 2)
===========changed ref 0===========
# module: pywhat.helper
class CaseInsensitiveSet(collections.abc.Set):
def issubset(self, other):
- for value in self:
- if value not in other:
- return False
- return True
+ return all(value in other for value in self)
===========changed ref 1===========
# module: pywhat.filter
class Distribution(Filter):
def _filter(self):
self._regexes = load_regexes()
- temp_regexes = []
- for regex in self._regexes:
- if regex in self:
- temp_regexes.append(regex)
-
+ temp_regexes = [regex for regex in self._regexes if regex in self]
self._regexes = temp_regexes
===========changed ref 2===========
# module: pywhat.filter
class Filter(Mapping):
def __init__(self, filters_dict: Optional[Mapping] = None):
tags = CaseInsensitiveSet(AvailableTags().get_tags())
self._dict = dict()
if filters_dict is None:
+ filters_dict = {}
- filters_dict = dict()
self._dict["Tags"] = CaseInsensitiveSet(filters_dict.setdefault("Tags", tags))
self._dict["ExcludeTags"] = CaseInsensitiveSet(
filters_dict.setdefault("ExcludeTags", set())
)
# We have regex with 0 rarity which trip false positive alarms all the time
self._dict["MinRarity"] = filters_dict.setdefault("MinRarity", 0.1)
self._dict["MaxRarity"] = filters_dict.setdefault("MaxRarity", 1)
if not self._dict["Tags"].issubset(tags) or not self._dict[
"ExcludeTags"
].issubset(tags):
raise InvalidTag("Passed filter contains tags that are not used by 'what'")
|
pywhat.what/create_filter
|
Modified
|
bee-san~pyWhat
|
ac0ffebe26ce659946be08cef4861321a42c4f77
|
added nano; simplify (#168)
|
<0>:<add> filters_dict = {}
<del> filters_dict = dict()
|
# module: pywhat.what
def create_filter(rarity, include, exclude):
<0> filters_dict = dict()
<1> if rarity is not None:
<2> rarities = rarity.split(":")
<3> if len(rarities) != 2:
<4> print("Invalid rarity range format ('min:max' expected)")
<5> sys.exit(1)
<6> try:
<7> if not rarities[0].isspace() and rarities[0]:
<8> filters_dict["MinRarity"] = float(rarities[0])
<9> if not rarities[1].isspace() and rarities[1]:
<10> filters_dict["MaxRarity"] = float(rarities[1])
<11> except ValueError:
<12> print("Invalid rarity argument (float expected)")
<13> sys.exit(1)
<14> if include is not None:
<15> filters_dict["Tags"] = list(map(str.strip, include.split(",")))
<16> if exclude is not None:
<17> filters_dict["ExcludeTags"] = list(map(str.strip, exclude.split(",")))
<18>
<19> try:
<20> filter = Filter(filters_dict)
<21> except InvalidTag:
<22> print(
<23> "Passed tags are not valid.\n"
<24> "You can check available tags by using: 'pywhat --tags'"
<25> )
<26> sys.exit(1)
<27>
<28> return filter
<29>
|
===========unchanged ref 0===========
at: pywhat.filter
Filter(filters_dict: Optional[Mapping]=None)
at: pywhat.helper
InvalidTag(*args: object)
at: sys
exit(status: object=..., /) -> NoReturn
===========changed ref 0===========
# module: pywhat.helper
class CaseInsensitiveSet(collections.abc.Set):
def issubset(self, other):
- for value in self:
- if value not in other:
- return False
- return True
+ return all(value in other for value in self)
===========changed ref 1===========
# module: pywhat.filter
class Distribution(Filter):
def _filter(self):
self._regexes = load_regexes()
- temp_regexes = []
- for regex in self._regexes:
- if regex in self:
- temp_regexes.append(regex)
-
+ temp_regexes = [regex for regex in self._regexes if regex in self]
self._regexes = temp_regexes
===========changed ref 2===========
# module: pywhat.identifier
class Identifier:
def __init__(
self,
*,
dist: Optional[Distribution] = None,
key: Callable = Keys.NONE,
reverse=False,
boundaryless: Optional[Filter] = None,
):
+ self.distribution = Distribution() if dist is None else dist
+ self.boundaryless = (
+ Filter({"Tags": []}) if boundaryless is None else boundaryless
- if dist is None:
- self.distribution = Distribution()
+ )
- else:
- self.distribution = dist
self._regex_id = RegexIdentifier()
self._key = key
self._reverse = reverse
- if boundaryless is None:
- self.boundaryless = Filter({"Tags": []})
- else:
- self.boundaryless = boundaryless
===========changed ref 3===========
# module: pywhat.filter
class Filter(Mapping):
def __init__(self, filters_dict: Optional[Mapping] = None):
tags = CaseInsensitiveSet(AvailableTags().get_tags())
self._dict = dict()
if filters_dict is None:
+ filters_dict = {}
- filters_dict = dict()
self._dict["Tags"] = CaseInsensitiveSet(filters_dict.setdefault("Tags", tags))
self._dict["ExcludeTags"] = CaseInsensitiveSet(
filters_dict.setdefault("ExcludeTags", set())
)
# We have regex with 0 rarity which trip false positive alarms all the time
self._dict["MinRarity"] = filters_dict.setdefault("MinRarity", 0.1)
self._dict["MaxRarity"] = filters_dict.setdefault("MaxRarity", 1)
if not self._dict["Tags"].issubset(tags) or not self._dict[
"ExcludeTags"
].issubset(tags):
raise InvalidTag("Passed filter contains tags that are not used by 'what'")
===========changed ref 4===========
# module: scripts.get_file_sigs
r = requests.get(
+ "https://en.wikipedia.org/w/index.php?title=" + "List_of_file_signatures&action=raw"
- "http://en.wikipedia.org/w/index.php?title=" + "List_of_file_signatures&action=raw"
)
wt = wtp.parse(r.text)
# prints first 3 items of json, delete [0:3] to print all.
to_iter = {"root": wt.tables[0].data()}
to_iter = to_iter["root"]
to_dump = []
+ populars = {"23 21"}
- populars = set(["23 21"])
for i in range(1, len(to_iter)):
to_insert = {}
to_insert["Hexadecimal File Signature"] = cleanhtml(to_iter[i][0]).replace(" ", "")
check_iso = cleanhtml(to_iter[i][1])
if len(set(check_iso)) <= 2:
to_insert["ISO 8859-1"] = None
else:
to_insert["ISO 8859-1"] = check_iso
check = to_iter[i][3]
if check == "":
to_insert["Filename Extension"] = None
else:
to_insert["Filename Extension"] = cleanhtml(check)
des = to_iter[i][4]
if "url" in des:
splits = des.split("=")
if "|" in splits[1]:
# https://wiki.wireshark.org/Development/LibpcapFileFormat#Global_Header|title
split_more = splits[1].split("|")
print(split_more)
to_insert["URL"] = split_more[0]
else:
to_insert["URL"] = splits[1]
</s>
===========changed ref 5===========
# module: scripts.get_file_sigs
# offset: 1
<s>URL"] = split_more[0]
else:
to_insert["URL"] = splits[1]
to_insert["Description"] = cleanhtml(splits[0])
else:
to_insert["Description"] = cleanhtml(to_iter[i][4])
if to_insert["Hexadecimal File Signature"] in populars:
to_insert["Popular"] = 1
else:
to_insert["Popular"] = 0
to_dump.append(to_insert)
with open("file_signatures.json", "w") as outfile:
json.dump(to_dump, outfile, indent=4)
# https://en.wikipedia.org/api/rest_v1/page/html/List_of_file_signatures
"""
{
"root": [
[
"[[Hexadecimal|Hex]] signature",
"ISO 8859-1",
"[[Offset (computer science)|Offset]]",
"[[Filename extension]]",
"Description"
],
[
"<pre>23 21</pre>",
"{{show file signature|23 21}}",
"0",
"",
"Script or data to be passed to the program following the [[Shebang (Unix)|shebang]] (#!)"
],
[
"<pre>a1 b2 c3 d4</pre>\n<pre>d4 c3 b2 a1</pre>",
"{{show file signature|a1 b2 c3 d4}}\n{{show file signature|d4 c3 b2 a1}}",
"0",
"pcap",
"Libpcap File Format<ref>{{cite web |url=https://wiki.wiresh</s>
===========changed ref 6===========
# module: scripts.get_file_sigs
# offset: 2
<s>org/Development/LibpcapFileFormat#Global_Header|title=Libpcap File Format|access-date=2018-06-19}}</ref>"
]
]
}
"""
|
pywhat.printer/Printing._check_if_exploit_in_json
|
Modified
|
bee-san~pyWhat
|
ac0ffebe26ce659946be08cef4861321a42c4f77
|
added nano; simplify (#168)
|
<0>:<add> if "File Signatures" in text and text["File Signatures"]:
<del> if "File Signatures" in text.keys() and text["File Signatures"]:
|
# module: pywhat.printer
class Printing:
def _check_if_exploit_in_json(self, text: dict) -> bool:
<0> if "File Signatures" in text.keys() and text["File Signatures"]:
<1> # loops files
<2> for file in text["Regexes"].keys():
<3> for i in text["Regexes"][file]:
<4> if "Exploit" in i.keys():
<5> self.bug_bounty_mode = True
<6> else:
<7> for value in text["Regexes"]["text"]:
<8> if "Exploit" in value["Regex Pattern"].keys():
<9> self.bug_bounty_mode = True
<10>
|
===========unchanged ref 0===========
at: pywhat.printer.Printing.__init__
self.bug_bounty_mode = False
===========changed ref 0===========
# module: pywhat.helper
class CaseInsensitiveSet(collections.abc.Set):
def issubset(self, other):
- for value in self:
- if value not in other:
- return False
- return True
+ return all(value in other for value in self)
===========changed ref 1===========
# module: tests.test_click
+
+
+ def test_file_fixture14():
+ runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
+ assert result.exit_code == 0
+ assert re.findall("Nano", str(result.output))
+
===========changed ref 2===========
# module: pywhat.filter
class Distribution(Filter):
def _filter(self):
self._regexes = load_regexes()
- temp_regexes = []
- for regex in self._regexes:
- if regex in self:
- temp_regexes.append(regex)
-
+ temp_regexes = [regex for regex in self._regexes if regex in self]
self._regexes = temp_regexes
===========changed ref 3===========
# module: pywhat.identifier
class Identifier:
def __init__(
self,
*,
dist: Optional[Distribution] = None,
key: Callable = Keys.NONE,
reverse=False,
boundaryless: Optional[Filter] = None,
):
+ self.distribution = Distribution() if dist is None else dist
+ self.boundaryless = (
+ Filter({"Tags": []}) if boundaryless is None else boundaryless
- if dist is None:
- self.distribution = Distribution()
+ )
- else:
- self.distribution = dist
self._regex_id = RegexIdentifier()
self._key = key
self._reverse = reverse
- if boundaryless is None:
- self.boundaryless = Filter({"Tags": []})
- else:
- self.boundaryless = boundaryless
===========changed ref 4===========
# module: pywhat.filter
class Filter(Mapping):
def __init__(self, filters_dict: Optional[Mapping] = None):
tags = CaseInsensitiveSet(AvailableTags().get_tags())
self._dict = dict()
if filters_dict is None:
+ filters_dict = {}
- filters_dict = dict()
self._dict["Tags"] = CaseInsensitiveSet(filters_dict.setdefault("Tags", tags))
self._dict["ExcludeTags"] = CaseInsensitiveSet(
filters_dict.setdefault("ExcludeTags", set())
)
# We have regex with 0 rarity which trip false positive alarms all the time
self._dict["MinRarity"] = filters_dict.setdefault("MinRarity", 0.1)
self._dict["MaxRarity"] = filters_dict.setdefault("MaxRarity", 1)
if not self._dict["Tags"].issubset(tags) or not self._dict[
"ExcludeTags"
].issubset(tags):
raise InvalidTag("Passed filter contains tags that are not used by 'what'")
===========changed ref 5===========
# module: pywhat.what
def create_filter(rarity, include, exclude):
+ filters_dict = {}
- filters_dict = dict()
if rarity is not None:
rarities = rarity.split(":")
if len(rarities) != 2:
print("Invalid rarity range format ('min:max' expected)")
sys.exit(1)
try:
if not rarities[0].isspace() and rarities[0]:
filters_dict["MinRarity"] = float(rarities[0])
if not rarities[1].isspace() and rarities[1]:
filters_dict["MaxRarity"] = float(rarities[1])
except ValueError:
print("Invalid rarity argument (float expected)")
sys.exit(1)
if include is not None:
filters_dict["Tags"] = list(map(str.strip, include.split(",")))
if exclude is not None:
filters_dict["ExcludeTags"] = list(map(str.strip, exclude.split(",")))
try:
filter = Filter(filters_dict)
except InvalidTag:
print(
"Passed tags are not valid.\n"
"You can check available tags by using: 'pywhat --tags'"
)
sys.exit(1)
return filter
===========changed ref 6===========
# module: scripts.get_file_sigs
r = requests.get(
+ "https://en.wikipedia.org/w/index.php?title=" + "List_of_file_signatures&action=raw"
- "http://en.wikipedia.org/w/index.php?title=" + "List_of_file_signatures&action=raw"
)
wt = wtp.parse(r.text)
# prints first 3 items of json, delete [0:3] to print all.
to_iter = {"root": wt.tables[0].data()}
to_iter = to_iter["root"]
to_dump = []
+ populars = {"23 21"}
- populars = set(["23 21"])
for i in range(1, len(to_iter)):
to_insert = {}
to_insert["Hexadecimal File Signature"] = cleanhtml(to_iter[i][0]).replace(" ", "")
check_iso = cleanhtml(to_iter[i][1])
if len(set(check_iso)) <= 2:
to_insert["ISO 8859-1"] = None
else:
to_insert["ISO 8859-1"] = check_iso
check = to_iter[i][3]
if check == "":
to_insert["Filename Extension"] = None
else:
to_insert["Filename Extension"] = cleanhtml(check)
des = to_iter[i][4]
if "url" in des:
splits = des.split("=")
if "|" in splits[1]:
# https://wiki.wireshark.org/Development/LibpcapFileFormat#Global_Header|title
split_more = splits[1].split("|")
print(split_more)
to_insert["URL"] = split_more[0]
else:
to_insert["URL"] = splits[1]
</s>
|
tests.test_regex_identifier/test_instapayment
|
Modified
|
bee-san~pyWhat
|
89797b5ca9d698fcd9950f6a24642bc3b8789367
|
Regex Tests: Added Hawk API test and Fixed Discord WebHook Regex (#173)
|
<0>:<add> res = r.check(["hawk.wz6bAoFDwcVQFCD9dofE.w2R1PWI8UTvEM4jd56XQ"])
<add> _assert_match_first_item("StackHawk API Key", res)
<del> res = r.check(["6387849878080951"])
<1>:<del> _assert_match_first_item("Insta Payment Card Number", res)
|
# module: tests.test_regex_identifier
def test_instapayment():
<0> res = r.check(["6387849878080951"])
<1> _assert_match_first_item("Insta Payment Card Number", res)
<2>
|
===========unchanged ref 0===========
at: pywhat.regex_identifier.RegexIdentifier
check(text, dist: Optional[Distribution]=None, *, boundaryless: Optional[Filter]=None)
at: tests.test_regex_identifier
r = regex_identifier.RegexIdentifier()
_assert_match_first_item(name, res)
|
tests.test_regex_identifier/_assert_match_in_items
|
Modified
|
bee-san~pyWhat
|
9394f5bfe3379ca760354f7fa096625c50d3745e
|
Added / fixed tests and regex (#175)
|
<0>:<del> for i in res:
<1>:<del> assert i["Regex Pattern"]["Name"] == name
<2>:<add> assert any(name in i["Regex Pattern"]["Name"] for i in res)
|
# module: tests.test_regex_identifier
def _assert_match_in_items(name, res):
<0> for i in res:
<1> assert i["Regex Pattern"]["Name"] == name
<2>
| |
pywhat.filter/Filter.__init__
|
Modified
|
bee-san~pyWhat
|
524b6fe8879d9955160165fc2e3fe821eda8aee5
|
Fix nox tests (#172)
|
<1>:<add> self._dict = {}
<del> self._dict = dict()
|
# module: pywhat.filter
class Filter(Mapping):
+ def __init__(self, filters_dict=None):
- def __init__(self, filters_dict: Optional[Mapping] = None):
<0> tags = CaseInsensitiveSet(AvailableTags().get_tags())
<1> self._dict = dict()
<2> if filters_dict is None:
<3> filters_dict = {}
<4>
<5> self._dict["Tags"] = CaseInsensitiveSet(filters_dict.setdefault("Tags", tags))
<6> self._dict["ExcludeTags"] = CaseInsensitiveSet(
<7> filters_dict.setdefault("ExcludeTags", set())
<8> )
<9> # We have regex with 0 rarity which trip false positive alarms all the time
<10> self._dict["MinRarity"] = filters_dict.setdefault("MinRarity", 0.1)
<11> self._dict["MaxRarity"] = filters_dict.setdefault("MaxRarity", 1)
<12> if not self._dict["Tags"].issubset(tags) or not self._dict[
<13> "ExcludeTags"
<14> ].issubset(tags):
<15> raise InvalidTag("Passed filter contains tags that are not used by 'what'")
<16>
|
===========unchanged ref 0===========
at: pywhat.helper
AvailableTags()
InvalidTag(*args: object)
CaseInsensitiveSet(iterable=None)
at: pywhat.helper.AvailableTags
get_tags()
|
pywhat.identifier/Identifier.identify
|
Modified
|
bee-san~pyWhat
|
524b6fe8879d9955160165fc2e3fe821eda8aee5
|
Fix nox tests (#172)
|
<9>:<add> identify_obj: dict = {"File Signatures": {}, "Regexes": {}}
<del> identify_obj = {"File Signatures": {}, "Regexes": {}}
<28>:<add> with open(string, "r", encoding="utf-8", errors="ignore") as file:
<del> with open(string, "r", encoding="utf-8", errors="ignore") as myfile:
<29>:<add> contents = [file.read()]
<del> contents = [myfile.read()]
|
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
<0> if dist is None:
<1> dist = self.distribution
<2> if key is None:
<3> key = self._key
<4> if reverse is None:
<5> reverse = self._reverse
<6> if boundaryless is None:
<7> boundaryless = self.boundaryless
<8>
<9> identify_obj = {"File Signatures": {}, "Regexes": {}}
<10> search = []
<11>
<12> if not only_text and os.path.isdir(text):
<13> # if input is a directory, recursively search for all of the files
<14> for myfile in glob.iglob(text + "/**", recursive=True):
<15> if os.path.isfile(myfile):
<16> search.append(os.path.abspath(myfile))
<17> else:
<18> search = [text]
<19>
<20> for string in search:
<21> if not only_text and os.path.isfile(string):
<22> if os.path.isdir(text):
<23> short_name = string.replace(os.path.abspath(text), "")
<24> else:
<25> short_name = os.path.basename(string)
<26>
<27> magic_numbers = pywhat.magic_numbers.get_magic_nums(string)
<28> with open(string, "r", encoding="utf-8", errors="ignore") as myfile:
<29> contents = [myfile.read()]
<30>
<31> if include_filenames:
<32> contents.append(os.path.basename(string))
<33>
</s>
|
===========below chunk 0===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
# offset: 1
contents, dist=dist, boundaryless=boundaryless
)
if not magic_numbers:
magic_numbers = pywhat.magic_numbers.check_magic_nums(string)
if magic_numbers:
identify_obj["File Signatures"][short_name] = magic_numbers
else:
short_name = "text"
regex = self._regex_id.check(
search, dist=dist, boundaryless=boundaryless
)
if regex:
identify_obj["Regexes"][short_name] = regex
for key_, value in identify_obj.items():
# if there are zero regex or file signature matches, set it to None
if len(identify_obj[key_]) == 0:
identify_obj[key_] = None
if key != Keys.NONE:
identify_obj["Regexes"][short_name] = sorted(
identify_obj["Regexes"][short_name], key=key, reverse=reverse
)
return identify_obj
===========unchanged ref 0===========
at: glob
iglob(pathname: AnyStr, *, recursive: bool=...) -> Iterator[AnyStr]
at: io.TextIOWrapper
read(self, size: Optional[int]=..., /) -> str
at: os.path
isfile(path: AnyPath) -> bool
isdir(s: AnyPath) -> bool
basename(p: _PathLike[AnyStr]) -> AnyStr
basename(p: AnyStr) -> AnyStr
abspath(path: _PathLike[AnyStr]) -> AnyStr
abspath(path: AnyStr) -> AnyStr
abspath = _abspath_fallback
at: pywhat.filter
Filter(filters_dict=None)
Distribution(filter: Optional[Filter]=None)
at: pywhat.helper
Keys()
at: pywhat.identifier.Identifier.__init__
self.distribution = Distribution() if dist is None else dist
self.boundaryless = (
Filter({"Tags": []}) if boundaryless is None else boundaryless
)
self._regex_id = RegexIdentifier()
self._key = key
self._reverse = reverse
at: pywhat.magic_numbers
get_magic_nums(file_loc)
check_magic_nums(text)
at: pywhat.regex_identifier.RegexIdentifier
check(text, dist: Optional[Distribution]=None, *, boundaryless: Optional[Filter]=None)
at: typing
Callable = _CallableType(collections.abc.Callable, 2)
at: typing.IO
__slots__ = ()
read(n: int=...) -> AnyStr
===========changed ref 0===========
# module: pywhat.filter
class Filter(Mapping):
+ def __init__(self, filters_dict=None):
- def __init__(self, filters_dict: Optional[Mapping] = None):
tags = CaseInsensitiveSet(AvailableTags().get_tags())
+ self._dict = {}
- self._dict = dict()
if filters_dict is None:
filters_dict = {}
self._dict["Tags"] = CaseInsensitiveSet(filters_dict.setdefault("Tags", tags))
self._dict["ExcludeTags"] = CaseInsensitiveSet(
filters_dict.setdefault("ExcludeTags", set())
)
# We have regex with 0 rarity which trip false positive alarms all the time
self._dict["MinRarity"] = filters_dict.setdefault("MinRarity", 0.1)
self._dict["MaxRarity"] = filters_dict.setdefault("MaxRarity", 1)
if not self._dict["Tags"].issubset(tags) or not self._dict[
"ExcludeTags"
].issubset(tags):
raise InvalidTag("Passed filter contains tags that are not used by 'what'")
|
tests.test_regex_identifier/test_stackhawk
|
Added
|
bee-san~pyWhat
|
524b6fe8879d9955160165fc2e3fe821eda8aee5
|
Fix nox tests (#172)
|
<0>:<add> res = r.check(["hawk.wz6bAoFDwcVQFCD9dofE.w2R1PWI8UTvEM4jd56XQ"])
<add> _assert_match_first_item("StackHawk API Key", res)
<add>
|
# module: tests.test_regex_identifier
+ def test_stackhawk():
<0> <extra_id_1><extra_id_2>
|
===========unchanged ref 0===========
at: pywhat.regex_identifier.RegexIdentifier
check(text, dist: Optional[Distribution]=None, *, boundaryless: Optional[Filter]=None)
at: tests.test_regex_identifier
r = regex_identifier.RegexIdentifier()
_assert_match_first_item(name, res)
===========changed ref 0===========
# module: pywhat.filter
class Filter(Mapping):
+ def __init__(self, filters_dict=None):
- def __init__(self, filters_dict: Optional[Mapping] = None):
tags = CaseInsensitiveSet(AvailableTags().get_tags())
+ self._dict = {}
- self._dict = dict()
if filters_dict is None:
filters_dict = {}
self._dict["Tags"] = CaseInsensitiveSet(filters_dict.setdefault("Tags", tags))
self._dict["ExcludeTags"] = CaseInsensitiveSet(
filters_dict.setdefault("ExcludeTags", set())
)
# We have regex with 0 rarity which trip false positive alarms all the time
self._dict["MinRarity"] = filters_dict.setdefault("MinRarity", 0.1)
self._dict["MaxRarity"] = filters_dict.setdefault("MaxRarity", 1)
if not self._dict["Tags"].issubset(tags) or not self._dict[
"ExcludeTags"
].issubset(tags):
raise InvalidTag("Passed filter contains tags that are not used by 'what'")
===========changed ref 1===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
if dist is None:
dist = self.distribution
if key is None:
key = self._key
if reverse is None:
reverse = self._reverse
if boundaryless is None:
boundaryless = self.boundaryless
+ identify_obj: dict = {"File Signatures": {}, "Regexes": {}}
- identify_obj = {"File Signatures": {}, "Regexes": {}}
search = []
if not only_text and os.path.isdir(text):
# if input is a directory, recursively search for all of the files
for myfile in glob.iglob(text + "/**", recursive=True):
if os.path.isfile(myfile):
search.append(os.path.abspath(myfile))
else:
search = [text]
for string in search:
if not only_text and os.path.isfile(string):
if os.path.isdir(text):
short_name = string.replace(os.path.abspath(text), "")
else:
short_name = os.path.basename(string)
magic_numbers = pywhat.magic_numbers.get_magic_nums(string)
+ with open(string, "r", encoding="utf-8", errors="ignore") as file:
- with open(string, "r", encoding="utf-8", errors="ignore") as myfile:
+ contents = [file.read()]
- contents = [myfile.read()]</s>
===========changed ref 2===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
# offset: 1
<s>") as myfile:
+ contents = [file.read()]
- contents = [myfile.read()]
if include_filenames:
contents.append(os.path.basename(string))
regex = self._regex_id.check(
contents, dist=dist, boundaryless=boundaryless
)
if not magic_numbers:
magic_numbers = pywhat.magic_numbers.check_magic_nums(string)
if magic_numbers:
identify_obj["File Signatures"][short_name] = magic_numbers
else:
short_name = "text"
regex = self._regex_id.check(
search, dist=dist, boundaryless=boundaryless
)
if regex:
identify_obj["Regexes"][short_name] = regex
for key_, value in identify_obj.items():
# if there are zero regex or file signature matches, set it to None
if len(identify_obj[key_]) == 0:
identify_obj[key_] = None
if key != Keys.NONE:
identify_obj["Regexes"][short_name] = sorted(
identify_obj["Regexes"][short_name], key=key, reverse=reverse
)
return identify_obj
===========changed ref 3===========
# module: scripts.get_file_sigs
r = requests.get(
"https://en.wikipedia.org/w/index.php?title=" + "List_of_file_signatures&action=raw"
)
wt = wtp.parse(r.text)
# prints first 3 items of json, delete [0:3] to print all.
+ sig_dict = {"root": wt.tables[0].data()}
- to_iter = {"root": wt.tables[0].data()}
+ to_iter = sig_dict["root"]
- to_iter = to_iter["root"]
to_dump = []
populars = {"23 21"}
for i in range(1, len(to_iter)):
to_insert = {}
to_insert["Hexadecimal File Signature"] = cleanhtml(to_iter[i][0]).replace(" ", "")
check_iso = cleanhtml(to_iter[i][1])
if len(set(check_iso)) <= 2:
to_insert["ISO 8859-1"] = None
else:
to_insert["ISO 8859-1"] = check_iso
check = to_iter[i][3]
if check == "":
to_insert["Filename Extension"] = None
else:
to_insert["Filename Extension"] = cleanhtml(check)
des = to_iter[i][4]
if "url" in des:
splits = des.split("=")
if "|" in splits[1]:
# https://wiki.wireshark.org/Development/LibpcapFileFormat#Global_Header|title
split_more = splits[1].split("|")
print(split_more)
to_insert["URL"] = split_more[0]
else:
to_insert["URL"] = splits[1]
to_insert["Description"] = cleanhtml(splits[0])
else</s>
|
tests.test_regex_identifier/test_stackhawk
|
Modified
|
bee-san~pyWhat
|
524b6fe8879d9955160165fc2e3fe821eda8aee5
|
Fix nox tests (#172)
|
<0>:<add> res = r.check(["hawk.wz6bAoFDwcVQFCD9dofE.w2R1PWI8UTvEM4jd56XQ"])
<add> _assert_match_first_item("StackHawk API Key", res)
<add>
|
# module: tests.test_regex_identifier
+ def test_stackhawk():
<0> <extra_id_1><extra_id_2>
|
===========unchanged ref 0===========
at: pywhat.regex_identifier.RegexIdentifier
check(text, dist: Optional[Distribution]=None, *, boundaryless: Optional[Filter]=None)
at: tests.test_regex_identifier
r = regex_identifier.RegexIdentifier()
_assert_match_first_item(name, res)
===========changed ref 0===========
# module: tests.test_regex_identifier
+ def test_stackhawk():
+ res = r.check(["hawk.wz6bAoFDwcVQFCD9dofE.w2R1PWI8UTvEM4jd56XQ"])
+ _assert_match_first_item("StackHawk API Key", res)
+
===========changed ref 1===========
# module: pywhat.filter
class Filter(Mapping):
+ def __init__(self, filters_dict=None):
- def __init__(self, filters_dict: Optional[Mapping] = None):
tags = CaseInsensitiveSet(AvailableTags().get_tags())
+ self._dict = {}
- self._dict = dict()
if filters_dict is None:
filters_dict = {}
self._dict["Tags"] = CaseInsensitiveSet(filters_dict.setdefault("Tags", tags))
self._dict["ExcludeTags"] = CaseInsensitiveSet(
filters_dict.setdefault("ExcludeTags", set())
)
# We have regex with 0 rarity which trip false positive alarms all the time
self._dict["MinRarity"] = filters_dict.setdefault("MinRarity", 0.1)
self._dict["MaxRarity"] = filters_dict.setdefault("MaxRarity", 1)
if not self._dict["Tags"].issubset(tags) or not self._dict[
"ExcludeTags"
].issubset(tags):
raise InvalidTag("Passed filter contains tags that are not used by 'what'")
===========changed ref 2===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
if dist is None:
dist = self.distribution
if key is None:
key = self._key
if reverse is None:
reverse = self._reverse
if boundaryless is None:
boundaryless = self.boundaryless
+ identify_obj: dict = {"File Signatures": {}, "Regexes": {}}
- identify_obj = {"File Signatures": {}, "Regexes": {}}
search = []
if not only_text and os.path.isdir(text):
# if input is a directory, recursively search for all of the files
for myfile in glob.iglob(text + "/**", recursive=True):
if os.path.isfile(myfile):
search.append(os.path.abspath(myfile))
else:
search = [text]
for string in search:
if not only_text and os.path.isfile(string):
if os.path.isdir(text):
short_name = string.replace(os.path.abspath(text), "")
else:
short_name = os.path.basename(string)
magic_numbers = pywhat.magic_numbers.get_magic_nums(string)
+ with open(string, "r", encoding="utf-8", errors="ignore") as file:
- with open(string, "r", encoding="utf-8", errors="ignore") as myfile:
+ contents = [file.read()]
- contents = [myfile.read()]</s>
===========changed ref 3===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
# offset: 1
<s>") as myfile:
+ contents = [file.read()]
- contents = [myfile.read()]
if include_filenames:
contents.append(os.path.basename(string))
regex = self._regex_id.check(
contents, dist=dist, boundaryless=boundaryless
)
if not magic_numbers:
magic_numbers = pywhat.magic_numbers.check_magic_nums(string)
if magic_numbers:
identify_obj["File Signatures"][short_name] = magic_numbers
else:
short_name = "text"
regex = self._regex_id.check(
search, dist=dist, boundaryless=boundaryless
)
if regex:
identify_obj["Regexes"][short_name] = regex
for key_, value in identify_obj.items():
# if there are zero regex or file signature matches, set it to None
if len(identify_obj[key_]) == 0:
identify_obj[key_] = None
if key != Keys.NONE:
identify_obj["Regexes"][short_name] = sorted(
identify_obj["Regexes"][short_name], key=key, reverse=reverse
)
return identify_obj
===========changed ref 4===========
# module: scripts.get_file_sigs
r = requests.get(
"https://en.wikipedia.org/w/index.php?title=" + "List_of_file_signatures&action=raw"
)
wt = wtp.parse(r.text)
# prints first 3 items of json, delete [0:3] to print all.
+ sig_dict = {"root": wt.tables[0].data()}
- to_iter = {"root": wt.tables[0].data()}
+ to_iter = sig_dict["root"]
- to_iter = to_iter["root"]
to_dump = []
populars = {"23 21"}
for i in range(1, len(to_iter)):
to_insert = {}
to_insert["Hexadecimal File Signature"] = cleanhtml(to_iter[i][0]).replace(" ", "")
check_iso = cleanhtml(to_iter[i][1])
if len(set(check_iso)) <= 2:
to_insert["ISO 8859-1"] = None
else:
to_insert["ISO 8859-1"] = check_iso
check = to_iter[i][3]
if check == "":
to_insert["Filename Extension"] = None
else:
to_insert["Filename Extension"] = cleanhtml(check)
des = to_iter[i][4]
if "url" in des:
splits = des.split("=")
if "|" in splits[1]:
# https://wiki.wireshark.org/Development/LibpcapFileFormat#Global_Header|title
split_more = splits[1].split("|")
print(split_more)
to_insert["URL"] = split_more[0]
else:
to_insert["URL"] = splits[1]
to_insert["Description"] = cleanhtml(splits[0])
else</s>
|
tests.test_regex_identifier/test_stripe_api_key
|
Modified
|
bee-san~pyWhat
|
524b6fe8879d9955160165fc2e3fe821eda8aee5
|
Fix nox tests (#172)
|
<0>:<add> res = r.check(["sk_live_vHDDrL02ioRF5vYtyqiYBKma"])
<del> res = r.check(["sk_live_26PHem9AhJZvU623DfE1x4sd"])
|
# module: tests.test_regex_identifier
def test_stripe_api_key():
<0> res = r.check(["sk_live_26PHem9AhJZvU623DfE1x4sd"])
<1> _assert_match_first_item("Stripe API Key", res)
<2>
|
===========unchanged ref 0===========
at: pywhat.regex_identifier.RegexIdentifier
check(text, dist: Optional[Distribution]=None, *, boundaryless: Optional[Filter]=None)
at: tests.test_regex_identifier
r = regex_identifier.RegexIdentifier()
_assert_match_first_item(name, res)
===========changed ref 0===========
# module: tests.test_regex_identifier
+ def test_stackhawk():
+ res = r.check(["hawk.wz6bAoFDwcVQFCD9dofE.w2R1PWI8UTvEM4jd56XQ"])
+ _assert_match_first_item("StackHawk API Key", res)
+
===========changed ref 1===========
# module: tests.test_regex_identifier
+ def test_stackhawk():
+ res = r.check(["hawk.wz6bAoFDwcVQFCD9dofE.w2R1PWI8UTvEM4jd56XQ"])
+ _assert_match_first_item("StackHawk API Key", res)
+
===========changed ref 2===========
# module: pywhat.filter
class Filter(Mapping):
+ def __init__(self, filters_dict=None):
- def __init__(self, filters_dict: Optional[Mapping] = None):
tags = CaseInsensitiveSet(AvailableTags().get_tags())
+ self._dict = {}
- self._dict = dict()
if filters_dict is None:
filters_dict = {}
self._dict["Tags"] = CaseInsensitiveSet(filters_dict.setdefault("Tags", tags))
self._dict["ExcludeTags"] = CaseInsensitiveSet(
filters_dict.setdefault("ExcludeTags", set())
)
# We have regex with 0 rarity which trip false positive alarms all the time
self._dict["MinRarity"] = filters_dict.setdefault("MinRarity", 0.1)
self._dict["MaxRarity"] = filters_dict.setdefault("MaxRarity", 1)
if not self._dict["Tags"].issubset(tags) or not self._dict[
"ExcludeTags"
].issubset(tags):
raise InvalidTag("Passed filter contains tags that are not used by 'what'")
===========changed ref 3===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
if dist is None:
dist = self.distribution
if key is None:
key = self._key
if reverse is None:
reverse = self._reverse
if boundaryless is None:
boundaryless = self.boundaryless
+ identify_obj: dict = {"File Signatures": {}, "Regexes": {}}
- identify_obj = {"File Signatures": {}, "Regexes": {}}
search = []
if not only_text and os.path.isdir(text):
# if input is a directory, recursively search for all of the files
for myfile in glob.iglob(text + "/**", recursive=True):
if os.path.isfile(myfile):
search.append(os.path.abspath(myfile))
else:
search = [text]
for string in search:
if not only_text and os.path.isfile(string):
if os.path.isdir(text):
short_name = string.replace(os.path.abspath(text), "")
else:
short_name = os.path.basename(string)
magic_numbers = pywhat.magic_numbers.get_magic_nums(string)
+ with open(string, "r", encoding="utf-8", errors="ignore") as file:
- with open(string, "r", encoding="utf-8", errors="ignore") as myfile:
+ contents = [file.read()]
- contents = [myfile.read()]</s>
===========changed ref 4===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
# offset: 1
<s>") as myfile:
+ contents = [file.read()]
- contents = [myfile.read()]
if include_filenames:
contents.append(os.path.basename(string))
regex = self._regex_id.check(
contents, dist=dist, boundaryless=boundaryless
)
if not magic_numbers:
magic_numbers = pywhat.magic_numbers.check_magic_nums(string)
if magic_numbers:
identify_obj["File Signatures"][short_name] = magic_numbers
else:
short_name = "text"
regex = self._regex_id.check(
search, dist=dist, boundaryless=boundaryless
)
if regex:
identify_obj["Regexes"][short_name] = regex
for key_, value in identify_obj.items():
# if there are zero regex or file signature matches, set it to None
if len(identify_obj[key_]) == 0:
identify_obj[key_] = None
if key != Keys.NONE:
identify_obj["Regexes"][short_name] = sorted(
identify_obj["Regexes"][short_name], key=key, reverse=reverse
)
return identify_obj
|
noxfile/tests
|
Modified
|
bee-san~pyWhat
|
524b6fe8879d9955160165fc2e3fe821eda8aee5
|
Fix nox tests (#172)
|
<2>:<add> install_with_constraints(
<add> session,
<add> "pytest",
<add> "pytest-black",
<add> "pytest-isort",
<add> "pytest-mypy",
<add> "types-requests",
<add> "types-orjson",
<add> )
<del> install_with_constraints(session, "pytest", "pytest-black", "pytest-isort")
|
# module: noxfile
+ @nox.session
- @nox.session(python=["3.8", "3.7"])
def tests(session: Session) -> None:
<0> """Run the test suite."""
<1> session.run("poetry", "install", "--no-dev", external=True)
<2> install_with_constraints(session, "pytest", "pytest-black", "pytest-isort")
<3> session.run("pytest")
<4>
|
===========changed ref 0===========
# module: noxfile
-
-
- @nox.session(python=["3.8", "3.7"])
- def lint(session: Session) -> None:
- pass
-
===========changed ref 1===========
# module: noxfile
-
-
- @nox.session(python="3.8")
- def black(session: Session) -> None:
- """Run black code formatter."""
- args = session.posargs or locations
- install_with_constraints(session, "black")
- session.run("black", *args)
-
===========changed ref 2===========
# module: noxfile
- package = "hypermodern_python"
+ nox.options.sessions = ["tests"]
- nox.options.sessions = "lint", "tests"
locations = "src", "tests", "noxfile.py", "docs/conf.py"
===========changed ref 3===========
# module: tests.test_regex_identifier
+ def test_stackhawk():
+ res = r.check(["hawk.wz6bAoFDwcVQFCD9dofE.w2R1PWI8UTvEM4jd56XQ"])
+ _assert_match_first_item("StackHawk API Key", res)
+
===========changed ref 4===========
# module: tests.test_regex_identifier
+ def test_stackhawk():
+ res = r.check(["hawk.wz6bAoFDwcVQFCD9dofE.w2R1PWI8UTvEM4jd56XQ"])
+ _assert_match_first_item("StackHawk API Key", res)
+
===========changed ref 5===========
# module: tests.test_regex_identifier
def test_stripe_api_key():
+ res = r.check(["sk_live_vHDDrL02ioRF5vYtyqiYBKma"])
- res = r.check(["sk_live_26PHem9AhJZvU623DfE1x4sd"])
_assert_match_first_item("Stripe API Key", res)
===========changed ref 6===========
# module: pywhat.filter
class Filter(Mapping):
+ def __init__(self, filters_dict=None):
- def __init__(self, filters_dict: Optional[Mapping] = None):
tags = CaseInsensitiveSet(AvailableTags().get_tags())
+ self._dict = {}
- self._dict = dict()
if filters_dict is None:
filters_dict = {}
self._dict["Tags"] = CaseInsensitiveSet(filters_dict.setdefault("Tags", tags))
self._dict["ExcludeTags"] = CaseInsensitiveSet(
filters_dict.setdefault("ExcludeTags", set())
)
# We have regex with 0 rarity which trip false positive alarms all the time
self._dict["MinRarity"] = filters_dict.setdefault("MinRarity", 0.1)
self._dict["MaxRarity"] = filters_dict.setdefault("MaxRarity", 1)
if not self._dict["Tags"].issubset(tags) or not self._dict[
"ExcludeTags"
].issubset(tags):
raise InvalidTag("Passed filter contains tags that are not used by 'what'")
===========changed ref 7===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
if dist is None:
dist = self.distribution
if key is None:
key = self._key
if reverse is None:
reverse = self._reverse
if boundaryless is None:
boundaryless = self.boundaryless
+ identify_obj: dict = {"File Signatures": {}, "Regexes": {}}
- identify_obj = {"File Signatures": {}, "Regexes": {}}
search = []
if not only_text and os.path.isdir(text):
# if input is a directory, recursively search for all of the files
for myfile in glob.iglob(text + "/**", recursive=True):
if os.path.isfile(myfile):
search.append(os.path.abspath(myfile))
else:
search = [text]
for string in search:
if not only_text and os.path.isfile(string):
if os.path.isdir(text):
short_name = string.replace(os.path.abspath(text), "")
else:
short_name = os.path.basename(string)
magic_numbers = pywhat.magic_numbers.get_magic_nums(string)
+ with open(string, "r", encoding="utf-8", errors="ignore") as file:
- with open(string, "r", encoding="utf-8", errors="ignore") as myfile:
+ contents = [file.read()]
- contents = [myfile.read()]</s>
===========changed ref 8===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
# offset: 1
<s>") as myfile:
+ contents = [file.read()]
- contents = [myfile.read()]
if include_filenames:
contents.append(os.path.basename(string))
regex = self._regex_id.check(
contents, dist=dist, boundaryless=boundaryless
)
if not magic_numbers:
magic_numbers = pywhat.magic_numbers.check_magic_nums(string)
if magic_numbers:
identify_obj["File Signatures"][short_name] = magic_numbers
else:
short_name = "text"
regex = self._regex_id.check(
search, dist=dist, boundaryless=boundaryless
)
if regex:
identify_obj["Regexes"][short_name] = regex
for key_, value in identify_obj.items():
# if there are zero regex or file signature matches, set it to None
if len(identify_obj[key_]) == 0:
identify_obj[key_] = None
if key != Keys.NONE:
identify_obj["Regexes"][short_name] = sorted(
identify_obj["Regexes"][short_name], key=key, reverse=reverse
)
return identify_obj
|
pywhat.filter/Filter.__init__
|
Modified
|
bee-san~pyWhat
|
4a6e3b16c123660934c0c82b6a0591599fe45db3
|
Revert "Fix nox tests (#172)" (#180)
|
<1>:<add> self._dict = dict()
<del> self._dict = {}
|
# module: pywhat.filter
class Filter(Mapping):
+ def __init__(self, filters_dict: Optional[Mapping] = None):
- def __init__(self, filters_dict=None):
<0> tags = CaseInsensitiveSet(AvailableTags().get_tags())
<1> self._dict = {}
<2> if filters_dict is None:
<3> filters_dict = {}
<4>
<5> self._dict["Tags"] = CaseInsensitiveSet(filters_dict.setdefault("Tags", tags))
<6> self._dict["ExcludeTags"] = CaseInsensitiveSet(
<7> filters_dict.setdefault("ExcludeTags", set())
<8> )
<9> # We have regex with 0 rarity which trip false positive alarms all the time
<10> self._dict["MinRarity"] = filters_dict.setdefault("MinRarity", 0.1)
<11> self._dict["MaxRarity"] = filters_dict.setdefault("MaxRarity", 1)
<12> if not self._dict["Tags"].issubset(tags) or not self._dict[
<13> "ExcludeTags"
<14> ].issubset(tags):
<15> raise InvalidTag("Passed filter contains tags that are not used by 'what'")
<16>
|
===========unchanged ref 0===========
at: pywhat.helper
AvailableTags()
InvalidTag(*args: object)
CaseInsensitiveSet(iterable=None)
at: pywhat.helper.AvailableTags
get_tags()
at: typing
Mapping = _alias(collections.abc.Mapping, 2)
|
pywhat.identifier/Identifier.identify
|
Modified
|
bee-san~pyWhat
|
4a6e3b16c123660934c0c82b6a0591599fe45db3
|
Revert "Fix nox tests (#172)" (#180)
|
<9>:<add> identify_obj = {"File Signatures": {}, "Regexes": {}}
<del> identify_obj: dict = {"File Signatures": {}, "Regexes": {}}
<28>:<add> with open(string, "r", encoding="utf-8", errors="ignore") as myfile:
<del> with open(string, "r", encoding="utf-8", errors="ignore") as file:
<29>:<add> contents = [myfile.read()]
<del> contents = [file.read()]
|
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
<0> if dist is None:
<1> dist = self.distribution
<2> if key is None:
<3> key = self._key
<4> if reverse is None:
<5> reverse = self._reverse
<6> if boundaryless is None:
<7> boundaryless = self.boundaryless
<8>
<9> identify_obj: dict = {"File Signatures": {}, "Regexes": {}}
<10> search = []
<11>
<12> if not only_text and os.path.isdir(text):
<13> # if input is a directory, recursively search for all of the files
<14> for myfile in glob.iglob(text + "/**", recursive=True):
<15> if os.path.isfile(myfile):
<16> search.append(os.path.abspath(myfile))
<17> else:
<18> search = [text]
<19>
<20> for string in search:
<21> if not only_text and os.path.isfile(string):
<22> if os.path.isdir(text):
<23> short_name = string.replace(os.path.abspath(text), "")
<24> else:
<25> short_name = os.path.basename(string)
<26>
<27> magic_numbers = pywhat.magic_numbers.get_magic_nums(string)
<28> with open(string, "r", encoding="utf-8", errors="ignore") as file:
<29> contents = [file.read()]
<30>
<31> if include_filenames:
<32> contents.append(os.path.basename(string))
<33>
</s>
|
===========below chunk 0===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
# offset: 1
contents, dist=dist, boundaryless=boundaryless
)
if not magic_numbers:
magic_numbers = pywhat.magic_numbers.check_magic_nums(string)
if magic_numbers:
identify_obj["File Signatures"][short_name] = magic_numbers
else:
short_name = "text"
regex = self._regex_id.check(
search, dist=dist, boundaryless=boundaryless
)
if regex:
identify_obj["Regexes"][short_name] = regex
for key_, value in identify_obj.items():
# if there are zero regex or file signature matches, set it to None
if len(identify_obj[key_]) == 0:
identify_obj[key_] = None
if key != Keys.NONE:
identify_obj["Regexes"][short_name] = sorted(
identify_obj["Regexes"][short_name], key=key, reverse=reverse
)
return identify_obj
===========unchanged ref 0===========
at: glob
iglob(pathname: AnyStr, *, recursive: bool=...) -> Iterator[AnyStr]
at: io.BufferedWriter
read(self, size: Optional[int]=..., /) -> bytes
at: os.path
isfile(path: AnyPath) -> bool
isdir(s: AnyPath) -> bool
basename(p: _PathLike[AnyStr]) -> AnyStr
basename(p: AnyStr) -> AnyStr
abspath(path: _PathLike[AnyStr]) -> AnyStr
abspath(path: AnyStr) -> AnyStr
abspath = _abspath_fallback
at: pywhat.filter
Filter(filters_dict: Optional[Mapping]=None)
Distribution(filter: Optional[Filter]=None)
at: pywhat.helper
Keys()
at: pywhat.identifier.Identifier.__init__
self.distribution = Distribution() if dist is None else dist
self.boundaryless = (
Filter({"Tags": []}) if boundaryless is None else boundaryless
)
self._regex_id = RegexIdentifier()
self._key = key
self._reverse = reverse
at: pywhat.magic_numbers
get_magic_nums(file_loc)
check_magic_nums(text)
at: pywhat.regex_identifier.RegexIdentifier
check(text, dist: Optional[Distribution]=None, *, boundaryless: Optional[Filter]=None)
at: typing
Callable = _CallableType(collections.abc.Callable, 2)
at: typing.IO
__slots__ = ()
read(n: int=...) -> AnyStr
===========changed ref 0===========
# module: pywhat.filter
class Filter(Mapping):
+ def __init__(self, filters_dict: Optional[Mapping] = None):
- def __init__(self, filters_dict=None):
tags = CaseInsensitiveSet(AvailableTags().get_tags())
+ self._dict = dict()
- self._dict = {}
if filters_dict is None:
filters_dict = {}
self._dict["Tags"] = CaseInsensitiveSet(filters_dict.setdefault("Tags", tags))
self._dict["ExcludeTags"] = CaseInsensitiveSet(
filters_dict.setdefault("ExcludeTags", set())
)
# We have regex with 0 rarity which trip false positive alarms all the time
self._dict["MinRarity"] = filters_dict.setdefault("MinRarity", 0.1)
self._dict["MaxRarity"] = filters_dict.setdefault("MaxRarity", 1)
if not self._dict["Tags"].issubset(tags) or not self._dict[
"ExcludeTags"
].issubset(tags):
raise InvalidTag("Passed filter contains tags that are not used by 'what'")
|
pywhat.printer/Printing.print_raw
|
Modified
|
bee-san~pyWhat
|
4a6e3b16c123660934c0c82b6a0591599fe45db3
|
Revert "Fix nox tests (#172)" (#180)
|
# module: pywhat.printer
class Printing:
def print_raw(self, text: dict, text_input) -> str:
<0> output_str = ""
<1>
<2> if text["File Signatures"] and text["Regexes"]:
<3> for key, value in text["File Signatures"].items():
<4> if value:
<5> output_str += "\n"
<6> output_str += f"[bold #D7Afff]File Identified[/bold #D7Afff]: [bold]{key}[/bold] with Magic Numbers {value['ISO 8859-1']}."
<7> output_str += f"\n[bold #D7Afff]File Description:[/bold #D7Afff] {value['Description']}."
<8> output_str += "\n"
<9>
<10> if text["Regexes"]:
<11> for key, value in text["Regexes"].items():
<12> for i in value:
<13> description = None
<14> matched = i["Matched"]
<15> if self._check_if_directory(text_input):
<16> output_str += f"[bold #D7Afff]File: {key}[/bold #D7Afff]\n"
<17> output_str += (
<18> "[bold #D7Afff]Matched on: [/bold #D7Afff]" + i["Matched"]
<19> )
<20> output_str += (
<21> "\n[bold #D7Afff]Name: [/bold #D7Afff]"
<22> + i["Regex Pattern"]["Name"]
<23> )
<24>
<25> link = None
<26> if "URL" in i["Regex Pattern"] and i["Regex Pattern"]["URL"]:
<27> link = (
<28> "\n[bold #D7Afff]Link: [/bold #D7Afff] "
<29> + i["Regex Pattern"]["URL"]
<30> + matched.replace(" ", "")
<31> )
<32>
<33> if link:
<34> output_str += link
<35>
<36> if i["Regex Pattern"]["Description"]:
<37> description = (
<38> "\n</s>
|
===========below chunk 0===========
# module: pywhat.printer
class Printing:
def print_raw(self, text: dict, text_input) -> str:
# offset: 1
+ i["Regex Pattern"]["Description"]
)
if description:
output_str += description
if (
"Exploit" in i["Regex Pattern"]
and i["Regex Pattern"]["Exploit"]
):
output_str += (
"\n[bold #D7Afff]Exploit: [/bold #D7Afff]"
+ i["Regex Pattern"]["Exploit"]
)
output_str += "\n\n"
if output_str == "" and not self.bug_bounty_mode:
self.console.print("Nothing found!")
if output_str.strip():
self.console.print(output_str.rstrip())
return output_str
===========unchanged ref 0===========
at: pywhat.printer.Printing
_check_if_directory(text_input)
_check_if_directory(self, text_input)
at: pywhat.printer.Printing.__init__
self.console = Console(highlight=False)
self.bug_bounty_mode = False
at: pywhat.printer.Printing._check_if_exploit_in_json
self.bug_bounty_mode = True
===========changed ref 0===========
# module: pywhat.filter
class Filter(Mapping):
+ def __init__(self, filters_dict: Optional[Mapping] = None):
- def __init__(self, filters_dict=None):
tags = CaseInsensitiveSet(AvailableTags().get_tags())
+ self._dict = dict()
- self._dict = {}
if filters_dict is None:
filters_dict = {}
self._dict["Tags"] = CaseInsensitiveSet(filters_dict.setdefault("Tags", tags))
self._dict["ExcludeTags"] = CaseInsensitiveSet(
filters_dict.setdefault("ExcludeTags", set())
)
# We have regex with 0 rarity which trip false positive alarms all the time
self._dict["MinRarity"] = filters_dict.setdefault("MinRarity", 0.1)
self._dict["MaxRarity"] = filters_dict.setdefault("MaxRarity", 1)
if not self._dict["Tags"].issubset(tags) or not self._dict[
"ExcludeTags"
].issubset(tags):
raise InvalidTag("Passed filter contains tags that are not used by 'what'")
===========changed ref 1===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
if dist is None:
dist = self.distribution
if key is None:
key = self._key
if reverse is None:
reverse = self._reverse
if boundaryless is None:
boundaryless = self.boundaryless
+ identify_obj = {"File Signatures": {}, "Regexes": {}}
- identify_obj: dict = {"File Signatures": {}, "Regexes": {}}
search = []
if not only_text and os.path.isdir(text):
# if input is a directory, recursively search for all of the files
for myfile in glob.iglob(text + "/**", recursive=True):
if os.path.isfile(myfile):
search.append(os.path.abspath(myfile))
else:
search = [text]
for string in search:
if not only_text and os.path.isfile(string):
if os.path.isdir(text):
short_name = string.replace(os.path.abspath(text), "")
else:
short_name = os.path.basename(string)
magic_numbers = pywhat.magic_numbers.get_magic_nums(string)
+ with open(string, "r", encoding="utf-8", errors="ignore") as myfile:
- with open(string, "r", encoding="utf-8", errors="ignore") as file:
+ contents = [myfile.read()]
- contents = [file.read()]</s>
===========changed ref 2===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
# offset: 1
<s>ignore") as file:
+ contents = [myfile.read()]
- contents = [file.read()]
if include_filenames:
contents.append(os.path.basename(string))
regex = self._regex_id.check(
contents, dist=dist, boundaryless=boundaryless
)
if not magic_numbers:
magic_numbers = pywhat.magic_numbers.check_magic_nums(string)
if magic_numbers:
identify_obj["File Signatures"][short_name] = magic_numbers
else:
short_name = "text"
regex = self._regex_id.check(
search, dist=dist, boundaryless=boundaryless
)
if regex:
identify_obj["Regexes"][short_name] = regex
for key_, value in identify_obj.items():
# if there are zero regex or file signature matches, set it to None
if len(identify_obj[key_]) == 0:
identify_obj[key_] = None
if key != Keys.NONE:
identify_obj["Regexes"][short_name] = sorted(
identify_obj["Regexes"][short_name], key=key, reverse=reverse
)
return identify_obj
|
|
pywhat.printer/Printing._check_if_exploit_in_json
|
Modified
|
bee-san~pyWhat
|
4a6e3b16c123660934c0c82b6a0591599fe45db3
|
Revert "Fix nox tests (#172)" (#180)
|
<11>:<del> return self.bug_bounty_mode
<12>:<del>
|
# module: pywhat.printer
class Printing:
def _check_if_exploit_in_json(self, text: dict) -> bool:
<0> if "File Signatures" in text and text["File Signatures"]:
<1> # loops files
<2> for file in text["Regexes"].keys():
<3> for i in text["Regexes"][file]:
<4> if "Exploit" in i.keys():
<5> self.bug_bounty_mode = True
<6> else:
<7> for value in text["Regexes"]["text"]:
<8> if "Exploit" in value["Regex Pattern"].keys():
<9> self.bug_bounty_mode = True
<10>
<11> return self.bug_bounty_mode
<12>
|
===========unchanged ref 0===========
at: os.path
isdir(s: AnyPath) -> bool
at: pywhat.printer.Printing.__init__
self.bug_bounty_mode = False
===========changed ref 0===========
# module: pywhat.printer
class Printing:
def print_raw(self, text: dict, text_input) -> str:
output_str = ""
if text["File Signatures"] and text["Regexes"]:
for key, value in text["File Signatures"].items():
if value:
output_str += "\n"
output_str += f"[bold #D7Afff]File Identified[/bold #D7Afff]: [bold]{key}[/bold] with Magic Numbers {value['ISO 8859-1']}."
output_str += f"\n[bold #D7Afff]File Description:[/bold #D7Afff] {value['Description']}."
output_str += "\n"
if text["Regexes"]:
for key, value in text["Regexes"].items():
for i in value:
description = None
matched = i["Matched"]
if self._check_if_directory(text_input):
output_str += f"[bold #D7Afff]File: {key}[/bold #D7Afff]\n"
output_str += (
"[bold #D7Afff]Matched on: [/bold #D7Afff]" + i["Matched"]
)
output_str += (
"\n[bold #D7Afff]Name: [/bold #D7Afff]"
+ i["Regex Pattern"]["Name"]
)
link = None
if "URL" in i["Regex Pattern"] and i["Regex Pattern"]["URL"]:
link = (
"\n[bold #D7Afff]Link: [/bold #D7Afff] "
+ i["Regex Pattern"]["URL"]
+ matched.replace(" ", "")
)
if link:
output_str += link
if i["Regex Pattern"]["Description"]:
description = (
"\n[bold #D7Afff]Description: [/bold #D7Afff]"
+ i["Regex Pattern"]["Description"]
)
if description</s>
===========changed ref 1===========
# module: pywhat.printer
class Printing:
def print_raw(self, text: dict, text_input) -> str:
# offset: 1
<s>: [/bold #D7Afff]"
+ i["Regex Pattern"]["Description"]
)
if description:
output_str += description
if (
"Exploit" in i["Regex Pattern"]
and i["Regex Pattern"]["Exploit"]
):
output_str += (
"\n[bold #D7Afff]Exploit: [/bold #D7Afff]"
+ i["Regex Pattern"]["Exploit"]
)
output_str += "\n\n"
if output_str == "" and not self.bug_bounty_mode:
self.console.print("Nothing found!")
if output_str.strip():
self.console.print(output_str.rstrip())
- return output_str
-
===========changed ref 2===========
# module: pywhat.filter
class Filter(Mapping):
+ def __init__(self, filters_dict: Optional[Mapping] = None):
- def __init__(self, filters_dict=None):
tags = CaseInsensitiveSet(AvailableTags().get_tags())
+ self._dict = dict()
- self._dict = {}
if filters_dict is None:
filters_dict = {}
self._dict["Tags"] = CaseInsensitiveSet(filters_dict.setdefault("Tags", tags))
self._dict["ExcludeTags"] = CaseInsensitiveSet(
filters_dict.setdefault("ExcludeTags", set())
)
# We have regex with 0 rarity which trip false positive alarms all the time
self._dict["MinRarity"] = filters_dict.setdefault("MinRarity", 0.1)
self._dict["MaxRarity"] = filters_dict.setdefault("MaxRarity", 1)
if not self._dict["Tags"].issubset(tags) or not self._dict[
"ExcludeTags"
].issubset(tags):
raise InvalidTag("Passed filter contains tags that are not used by 'what'")
===========changed ref 3===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
if dist is None:
dist = self.distribution
if key is None:
key = self._key
if reverse is None:
reverse = self._reverse
if boundaryless is None:
boundaryless = self.boundaryless
+ identify_obj = {"File Signatures": {}, "Regexes": {}}
- identify_obj: dict = {"File Signatures": {}, "Regexes": {}}
search = []
if not only_text and os.path.isdir(text):
# if input is a directory, recursively search for all of the files
for myfile in glob.iglob(text + "/**", recursive=True):
if os.path.isfile(myfile):
search.append(os.path.abspath(myfile))
else:
search = [text]
for string in search:
if not only_text and os.path.isfile(string):
if os.path.isdir(text):
short_name = string.replace(os.path.abspath(text), "")
else:
short_name = os.path.basename(string)
magic_numbers = pywhat.magic_numbers.get_magic_nums(string)
+ with open(string, "r", encoding="utf-8", errors="ignore") as myfile:
- with open(string, "r", encoding="utf-8", errors="ignore") as file:
+ contents = [myfile.read()]
- contents = [file.read()]</s>
|
tests.test_regex_identifier/test_stripe_api_key
|
Modified
|
bee-san~pyWhat
|
4a6e3b16c123660934c0c82b6a0591599fe45db3
|
Revert "Fix nox tests (#172)" (#180)
|
<0>:<add> res = r.check(["sk_live_26PHem9AhJZvU623DfE1x4sd"])
<del> res = r.check(["sk_live_vHDDrL02ioRF5vYtyqiYBKma"])
|
# module: tests.test_regex_identifier
def test_stripe_api_key():
<0> res = r.check(["sk_live_vHDDrL02ioRF5vYtyqiYBKma"])
<1> _assert_match_first_item("Stripe API Key", res)
<2>
|
===========unchanged ref 0===========
at: pywhat.regex_identifier.RegexIdentifier
check(text, dist: Optional[Distribution]=None, *, boundaryless: Optional[Filter]=None)
at: tests.test_regex_identifier
r = regex_identifier.RegexIdentifier()
_assert_match_first_item(name, res)
===========changed ref 0===========
# module: pywhat.printer
class Printing:
def _check_if_exploit_in_json(self, text: dict) -> bool:
if "File Signatures" in text and text["File Signatures"]:
# loops files
for file in text["Regexes"].keys():
for i in text["Regexes"][file]:
if "Exploit" in i.keys():
self.bug_bounty_mode = True
else:
for value in text["Regexes"]["text"]:
if "Exploit" in value["Regex Pattern"].keys():
self.bug_bounty_mode = True
- return self.bug_bounty_mode
-
===========changed ref 1===========
# module: pywhat.filter
class Filter(Mapping):
+ def __init__(self, filters_dict: Optional[Mapping] = None):
- def __init__(self, filters_dict=None):
tags = CaseInsensitiveSet(AvailableTags().get_tags())
+ self._dict = dict()
- self._dict = {}
if filters_dict is None:
filters_dict = {}
self._dict["Tags"] = CaseInsensitiveSet(filters_dict.setdefault("Tags", tags))
self._dict["ExcludeTags"] = CaseInsensitiveSet(
filters_dict.setdefault("ExcludeTags", set())
)
# We have regex with 0 rarity which trip false positive alarms all the time
self._dict["MinRarity"] = filters_dict.setdefault("MinRarity", 0.1)
self._dict["MaxRarity"] = filters_dict.setdefault("MaxRarity", 1)
if not self._dict["Tags"].issubset(tags) or not self._dict[
"ExcludeTags"
].issubset(tags):
raise InvalidTag("Passed filter contains tags that are not used by 'what'")
===========changed ref 2===========
# module: pywhat.printer
class Printing:
def print_raw(self, text: dict, text_input) -> str:
output_str = ""
if text["File Signatures"] and text["Regexes"]:
for key, value in text["File Signatures"].items():
if value:
output_str += "\n"
output_str += f"[bold #D7Afff]File Identified[/bold #D7Afff]: [bold]{key}[/bold] with Magic Numbers {value['ISO 8859-1']}."
output_str += f"\n[bold #D7Afff]File Description:[/bold #D7Afff] {value['Description']}."
output_str += "\n"
if text["Regexes"]:
for key, value in text["Regexes"].items():
for i in value:
description = None
matched = i["Matched"]
if self._check_if_directory(text_input):
output_str += f"[bold #D7Afff]File: {key}[/bold #D7Afff]\n"
output_str += (
"[bold #D7Afff]Matched on: [/bold #D7Afff]" + i["Matched"]
)
output_str += (
"\n[bold #D7Afff]Name: [/bold #D7Afff]"
+ i["Regex Pattern"]["Name"]
)
link = None
if "URL" in i["Regex Pattern"] and i["Regex Pattern"]["URL"]:
link = (
"\n[bold #D7Afff]Link: [/bold #D7Afff] "
+ i["Regex Pattern"]["URL"]
+ matched.replace(" ", "")
)
if link:
output_str += link
if i["Regex Pattern"]["Description"]:
description = (
"\n[bold #D7Afff]Description: [/bold #D7Afff]"
+ i["Regex Pattern"]["Description"]
)
if description</s>
===========changed ref 3===========
# module: pywhat.printer
class Printing:
def print_raw(self, text: dict, text_input) -> str:
# offset: 1
<s>: [/bold #D7Afff]"
+ i["Regex Pattern"]["Description"]
)
if description:
output_str += description
if (
"Exploit" in i["Regex Pattern"]
and i["Regex Pattern"]["Exploit"]
):
output_str += (
"\n[bold #D7Afff]Exploit: [/bold #D7Afff]"
+ i["Regex Pattern"]["Exploit"]
)
output_str += "\n\n"
if output_str == "" and not self.bug_bounty_mode:
self.console.print("Nothing found!")
if output_str.strip():
self.console.print(output_str.rstrip())
- return output_str
-
===========changed ref 4===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
if dist is None:
dist = self.distribution
if key is None:
key = self._key
if reverse is None:
reverse = self._reverse
if boundaryless is None:
boundaryless = self.boundaryless
+ identify_obj = {"File Signatures": {}, "Regexes": {}}
- identify_obj: dict = {"File Signatures": {}, "Regexes": {}}
search = []
if not only_text and os.path.isdir(text):
# if input is a directory, recursively search for all of the files
for myfile in glob.iglob(text + "/**", recursive=True):
if os.path.isfile(myfile):
search.append(os.path.abspath(myfile))
else:
search = [text]
for string in search:
if not only_text and os.path.isfile(string):
if os.path.isdir(text):
short_name = string.replace(os.path.abspath(text), "")
else:
short_name = os.path.basename(string)
magic_numbers = pywhat.magic_numbers.get_magic_nums(string)
+ with open(string, "r", encoding="utf-8", errors="ignore") as myfile:
- with open(string, "r", encoding="utf-8", errors="ignore") as file:
+ contents = [myfile.read()]
- contents = [file.read()]</s>
|
tests.test_regex_identifier/test_instapayment
|
Modified
|
bee-san~pyWhat
|
4a6e3b16c123660934c0c82b6a0591599fe45db3
|
Revert "Fix nox tests (#172)" (#180)
|
<0>:<add> res = r.check(["hawk.wz6bAoFDwcVQFCD9dofE.w2R1PWI8UTvEM4jd56XQ"])
<add> _assert_match_first_item("StackHawk API Key", res)
<del> res = r.check(["6387849878080951"])
<1>:<del> _assert_match_first_item("Insta Payment Card Number", res)
|
# module: tests.test_regex_identifier
def test_instapayment():
<0> res = r.check(["6387849878080951"])
<1> _assert_match_first_item("Insta Payment Card Number", res)
<2>
|
===========unchanged ref 0===========
at: pywhat.regex_identifier.RegexIdentifier
check(text, dist: Optional[Distribution]=None, *, boundaryless: Optional[Filter]=None)
at: tests.test_regex_identifier
r = regex_identifier.RegexIdentifier()
_assert_match_first_item(name, res)
===========changed ref 0===========
# module: tests.test_regex_identifier
def test_stripe_api_key():
+ res = r.check(["sk_live_26PHem9AhJZvU623DfE1x4sd"])
- res = r.check(["sk_live_vHDDrL02ioRF5vYtyqiYBKma"])
_assert_match_first_item("Stripe API Key", res)
===========changed ref 1===========
# module: pywhat.printer
class Printing:
def _check_if_exploit_in_json(self, text: dict) -> bool:
if "File Signatures" in text and text["File Signatures"]:
# loops files
for file in text["Regexes"].keys():
for i in text["Regexes"][file]:
if "Exploit" in i.keys():
self.bug_bounty_mode = True
else:
for value in text["Regexes"]["text"]:
if "Exploit" in value["Regex Pattern"].keys():
self.bug_bounty_mode = True
- return self.bug_bounty_mode
-
===========changed ref 2===========
# module: pywhat.filter
class Filter(Mapping):
+ def __init__(self, filters_dict: Optional[Mapping] = None):
- def __init__(self, filters_dict=None):
tags = CaseInsensitiveSet(AvailableTags().get_tags())
+ self._dict = dict()
- self._dict = {}
if filters_dict is None:
filters_dict = {}
self._dict["Tags"] = CaseInsensitiveSet(filters_dict.setdefault("Tags", tags))
self._dict["ExcludeTags"] = CaseInsensitiveSet(
filters_dict.setdefault("ExcludeTags", set())
)
# We have regex with 0 rarity which trip false positive alarms all the time
self._dict["MinRarity"] = filters_dict.setdefault("MinRarity", 0.1)
self._dict["MaxRarity"] = filters_dict.setdefault("MaxRarity", 1)
if not self._dict["Tags"].issubset(tags) or not self._dict[
"ExcludeTags"
].issubset(tags):
raise InvalidTag("Passed filter contains tags that are not used by 'what'")
===========changed ref 3===========
# module: pywhat.printer
class Printing:
def print_raw(self, text: dict, text_input) -> str:
output_str = ""
if text["File Signatures"] and text["Regexes"]:
for key, value in text["File Signatures"].items():
if value:
output_str += "\n"
output_str += f"[bold #D7Afff]File Identified[/bold #D7Afff]: [bold]{key}[/bold] with Magic Numbers {value['ISO 8859-1']}."
output_str += f"\n[bold #D7Afff]File Description:[/bold #D7Afff] {value['Description']}."
output_str += "\n"
if text["Regexes"]:
for key, value in text["Regexes"].items():
for i in value:
description = None
matched = i["Matched"]
if self._check_if_directory(text_input):
output_str += f"[bold #D7Afff]File: {key}[/bold #D7Afff]\n"
output_str += (
"[bold #D7Afff]Matched on: [/bold #D7Afff]" + i["Matched"]
)
output_str += (
"\n[bold #D7Afff]Name: [/bold #D7Afff]"
+ i["Regex Pattern"]["Name"]
)
link = None
if "URL" in i["Regex Pattern"] and i["Regex Pattern"]["URL"]:
link = (
"\n[bold #D7Afff]Link: [/bold #D7Afff] "
+ i["Regex Pattern"]["URL"]
+ matched.replace(" ", "")
)
if link:
output_str += link
if i["Regex Pattern"]["Description"]:
description = (
"\n[bold #D7Afff]Description: [/bold #D7Afff]"
+ i["Regex Pattern"]["Description"]
)
if description</s>
===========changed ref 4===========
# module: pywhat.printer
class Printing:
def print_raw(self, text: dict, text_input) -> str:
# offset: 1
<s>: [/bold #D7Afff]"
+ i["Regex Pattern"]["Description"]
)
if description:
output_str += description
if (
"Exploit" in i["Regex Pattern"]
and i["Regex Pattern"]["Exploit"]
):
output_str += (
"\n[bold #D7Afff]Exploit: [/bold #D7Afff]"
+ i["Regex Pattern"]["Exploit"]
)
output_str += "\n\n"
if output_str == "" and not self.bug_bounty_mode:
self.console.print("Nothing found!")
if output_str.strip():
self.console.print(output_str.rstrip())
- return output_str
-
===========changed ref 5===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
if dist is None:
dist = self.distribution
if key is None:
key = self._key
if reverse is None:
reverse = self._reverse
if boundaryless is None:
boundaryless = self.boundaryless
+ identify_obj = {"File Signatures": {}, "Regexes": {}}
- identify_obj: dict = {"File Signatures": {}, "Regexes": {}}
search = []
if not only_text and os.path.isdir(text):
# if input is a directory, recursively search for all of the files
for myfile in glob.iglob(text + "/**", recursive=True):
if os.path.isfile(myfile):
search.append(os.path.abspath(myfile))
else:
search = [text]
for string in search:
if not only_text and os.path.isfile(string):
if os.path.isdir(text):
short_name = string.replace(os.path.abspath(text), "")
else:
short_name = os.path.basename(string)
magic_numbers = pywhat.magic_numbers.get_magic_nums(string)
+ with open(string, "r", encoding="utf-8", errors="ignore") as myfile:
- with open(string, "r", encoding="utf-8", errors="ignore") as file:
+ contents = [myfile.read()]
- contents = [file.read()]</s>
|
noxfile/tests
|
Modified
|
bee-san~pyWhat
|
4a6e3b16c123660934c0c82b6a0591599fe45db3
|
Revert "Fix nox tests (#172)" (#180)
|
<2>:<del> install_with_constraints(
<3>:<del> session,
<4>:<del> "pytest",
<5>:<del> "pytest-black",
<6>:<del> "pytest-isort",
<7>:<del> "pytest-mypy",
<8>:<del> "types-requests",
<9>:<del> "types-orjson",
<10>:<del> )
<11>:<add> install_with_constraints(session, "pytest", "pytest-black", "pytest-isort")
|
# module: noxfile
+ @nox.session(python=["3.8", "3.7"])
- @nox.session
def tests(session: Session) -> None:
<0> """Run the test suite."""
<1> session.run("poetry", "install", "--no-dev", external=True)
<2> install_with_constraints(
<3> session,
<4> "pytest",
<5> "pytest-black",
<6> "pytest-isort",
<7> "pytest-mypy",
<8> "types-requests",
<9> "types-orjson",
<10> )
<11> session.run("pytest")
<12>
|
===========unchanged ref 0===========
at: noxfile
locations = "src", "tests", "noxfile.py", "docs/conf.py"
install_with_constraints(session: Session, *args: str, **kwargs: Any) -> None
===========changed ref 0===========
# module: noxfile
+ package = "hypermodern_python"
+ nox.options.sessions = "lint", "tests"
- nox.options.sessions = ["tests"]
locations = "src", "tests", "noxfile.py", "docs/conf.py"
===========changed ref 1===========
# module: tests.test_regex_identifier
- def test_stackhawk():
- res = r.check(["hawk.wz6bAoFDwcVQFCD9dofE.w2R1PWI8UTvEM4jd56XQ"])
- _assert_match_first_item("StackHawk API Key", res)
-
===========changed ref 2===========
# module: tests.test_regex_identifier
def test_stripe_api_key():
+ res = r.check(["sk_live_26PHem9AhJZvU623DfE1x4sd"])
- res = r.check(["sk_live_vHDDrL02ioRF5vYtyqiYBKma"])
_assert_match_first_item("Stripe API Key", res)
===========changed ref 3===========
# module: tests.test_regex_identifier
def test_instapayment():
+ res = r.check(["hawk.wz6bAoFDwcVQFCD9dofE.w2R1PWI8UTvEM4jd56XQ"])
+ _assert_match_first_item("StackHawk API Key", res)
- res = r.check(["6387849878080951"])
- _assert_match_first_item("Insta Payment Card Number", res)
===========changed ref 4===========
# module: pywhat.printer
class Printing:
def _check_if_exploit_in_json(self, text: dict) -> bool:
if "File Signatures" in text and text["File Signatures"]:
# loops files
for file in text["Regexes"].keys():
for i in text["Regexes"][file]:
if "Exploit" in i.keys():
self.bug_bounty_mode = True
else:
for value in text["Regexes"]["text"]:
if "Exploit" in value["Regex Pattern"].keys():
self.bug_bounty_mode = True
- return self.bug_bounty_mode
-
===========changed ref 5===========
# module: pywhat.filter
class Filter(Mapping):
+ def __init__(self, filters_dict: Optional[Mapping] = None):
- def __init__(self, filters_dict=None):
tags = CaseInsensitiveSet(AvailableTags().get_tags())
+ self._dict = dict()
- self._dict = {}
if filters_dict is None:
filters_dict = {}
self._dict["Tags"] = CaseInsensitiveSet(filters_dict.setdefault("Tags", tags))
self._dict["ExcludeTags"] = CaseInsensitiveSet(
filters_dict.setdefault("ExcludeTags", set())
)
# We have regex with 0 rarity which trip false positive alarms all the time
self._dict["MinRarity"] = filters_dict.setdefault("MinRarity", 0.1)
self._dict["MaxRarity"] = filters_dict.setdefault("MaxRarity", 1)
if not self._dict["Tags"].issubset(tags) or not self._dict[
"ExcludeTags"
].issubset(tags):
raise InvalidTag("Passed filter contains tags that are not used by 'what'")
===========changed ref 6===========
# module: pywhat.printer
class Printing:
def print_raw(self, text: dict, text_input) -> str:
output_str = ""
if text["File Signatures"] and text["Regexes"]:
for key, value in text["File Signatures"].items():
if value:
output_str += "\n"
output_str += f"[bold #D7Afff]File Identified[/bold #D7Afff]: [bold]{key}[/bold] with Magic Numbers {value['ISO 8859-1']}."
output_str += f"\n[bold #D7Afff]File Description:[/bold #D7Afff] {value['Description']}."
output_str += "\n"
if text["Regexes"]:
for key, value in text["Regexes"].items():
for i in value:
description = None
matched = i["Matched"]
if self._check_if_directory(text_input):
output_str += f"[bold #D7Afff]File: {key}[/bold #D7Afff]\n"
output_str += (
"[bold #D7Afff]Matched on: [/bold #D7Afff]" + i["Matched"]
)
output_str += (
"\n[bold #D7Afff]Name: [/bold #D7Afff]"
+ i["Regex Pattern"]["Name"]
)
link = None
if "URL" in i["Regex Pattern"] and i["Regex Pattern"]["URL"]:
link = (
"\n[bold #D7Afff]Link: [/bold #D7Afff] "
+ i["Regex Pattern"]["URL"]
+ matched.replace(" ", "")
)
if link:
output_str += link
if i["Regex Pattern"]["Description"]:
description = (
"\n[bold #D7Afff]Description: [/bold #D7Afff]"
+ i["Regex Pattern"]["Description"]
)
if description</s>
===========changed ref 7===========
# module: pywhat.printer
class Printing:
def print_raw(self, text: dict, text_input) -> str:
# offset: 1
<s>: [/bold #D7Afff]"
+ i["Regex Pattern"]["Description"]
)
if description:
output_str += description
if (
"Exploit" in i["Regex Pattern"]
and i["Regex Pattern"]["Exploit"]
):
output_str += (
"\n[bold #D7Afff]Exploit: [/bold #D7Afff]"
+ i["Regex Pattern"]["Exploit"]
)
output_str += "\n\n"
if output_str == "" and not self.bug_bounty_mode:
self.console.print("Nothing found!")
if output_str.strip():
self.console.print(output_str.rstrip())
- return output_str
-
|
pywhat.identifier/Identifier.identify
|
Modified
|
bee-san~pyWhat
|
b83558af72c86fb7e0295697962310af3ef15f93
|
leverage falseness of empty dicts (#181)
|
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
<0> if dist is None:
<1> dist = self.distribution
<2> if key is None:
<3> key = self._key
<4> if reverse is None:
<5> reverse = self._reverse
<6> if boundaryless is None:
<7> boundaryless = self.boundaryless
<8>
<9> identify_obj = {"File Signatures": {}, "Regexes": {}}
<10> search = []
<11>
<12> if not only_text and os.path.isdir(text):
<13> # if input is a directory, recursively search for all of the files
<14> for myfile in glob.iglob(text + "/**", recursive=True):
<15> if os.path.isfile(myfile):
<16> search.append(os.path.abspath(myfile))
<17> else:
<18> search = [text]
<19>
<20> for string in search:
<21> if not only_text and os.path.isfile(string):
<22> if os.path.isdir(text):
<23> short_name = string.replace(os.path.abspath(text), "")
<24> else:
<25> short_name = os.path.basename(string)
<26>
<27> magic_numbers = pywhat.magic_numbers.get_magic_nums(string)
<28> with open(string, "r", encoding="utf-8", errors="ignore") as myfile:
<29> contents = [myfile.read()]
<30>
<31> if include_filenames:
<32> contents.append(os.path.basename(string))
<33>
</s>
|
===========below chunk 0===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
# offset: 1
contents, dist=dist, boundaryless=boundaryless
)
if not magic_numbers:
magic_numbers = pywhat.magic_numbers.check_magic_nums(string)
if magic_numbers:
identify_obj["File Signatures"][short_name] = magic_numbers
else:
short_name = "text"
regex = self._regex_id.check(
search, dist=dist, boundaryless=boundaryless
)
if regex:
identify_obj["Regexes"][short_name] = regex
for key_, value in identify_obj.items():
# if there are zero regex or file signature matches, set it to None
if len(identify_obj[key_]) == 0:
identify_obj[key_] = None
if key != Keys.NONE:
identify_obj["Regexes"][short_name] = sorted(
identify_obj["Regexes"][short_name], key=key, reverse=reverse
)
return identify_obj
===========unchanged ref 0===========
at: glob
iglob(pathname: AnyStr, *, recursive: bool=...) -> Iterator[AnyStr]
at: io.BufferedWriter
read(self, size: Optional[int]=..., /) -> bytes
at: os.path
isfile(path: AnyPath) -> bool
isdir(s: AnyPath) -> bool
basename(p: _PathLike[AnyStr]) -> AnyStr
basename(p: AnyStr) -> AnyStr
abspath(path: _PathLike[AnyStr]) -> AnyStr
abspath(path: AnyStr) -> AnyStr
abspath = _abspath_fallback
at: pywhat.filter
Filter(filters_dict: Optional[Mapping]=None)
Distribution(filter: Optional[Filter]=None)
at: pywhat.helper
Keys()
at: pywhat.identifier.Identifier.__init__
self.distribution = Distribution() if dist is None else dist
self.boundaryless = (
Filter({"Tags": []}) if boundaryless is None else boundaryless
)
self._regex_id = RegexIdentifier()
self._key = key
self._reverse = reverse
at: pywhat.magic_numbers
get_magic_nums(file_loc)
check_magic_nums(text)
at: pywhat.regex_identifier.RegexIdentifier
check(text, dist: Optional[Distribution]=None, *, boundaryless: Optional[Filter]=None)
at: typing
Callable = _CallableType(collections.abc.Callable, 2)
at: typing.IO
__slots__ = ()
read(n: int=...) -> AnyStr
|
|
pywhat.filter/Filter.__init__
|
Modified
|
bee-san~pyWhat
|
611628724aa518c03c94f383d1387c2bd6111740
|
Fix Python 3.8 and Python 3.9 CI checks (#182)
|
<1>:<add> self._dict = {}
<del> self._dict = dict()
|
# module: pywhat.filter
class Filter(Mapping):
+ def __init__(self, filters_dict=None):
- def __init__(self, filters_dict: Optional[Mapping] = None):
<0> tags = CaseInsensitiveSet(AvailableTags().get_tags())
<1> self._dict = dict()
<2> if filters_dict is None:
<3> filters_dict = {}
<4>
<5> self._dict["Tags"] = CaseInsensitiveSet(filters_dict.setdefault("Tags", tags))
<6> self._dict["ExcludeTags"] = CaseInsensitiveSet(
<7> filters_dict.setdefault("ExcludeTags", set())
<8> )
<9> # We have regex with 0 rarity which trip false positive alarms all the time
<10> self._dict["MinRarity"] = filters_dict.setdefault("MinRarity", 0.1)
<11> self._dict["MaxRarity"] = filters_dict.setdefault("MaxRarity", 1)
<12> if not self._dict["Tags"].issubset(tags) or not self._dict[
<13> "ExcludeTags"
<14> ].issubset(tags):
<15> raise InvalidTag("Passed filter contains tags that are not used by 'what'")
<16>
|
===========unchanged ref 0===========
at: pywhat.helper
AvailableTags()
InvalidTag(*args: object)
CaseInsensitiveSet(iterable=None)
at: pywhat.helper.AvailableTags
get_tags()
|
pywhat.identifier/Identifier.identify
|
Modified
|
bee-san~pyWhat
|
611628724aa518c03c94f383d1387c2bd6111740
|
Fix Python 3.8 and Python 3.9 CI checks (#182)
|
<9>:<add> identify_obj: dict = {"File Signatures": {}, "Regexes": {}}
<del> identify_obj = {"File Signatures": {}, "Regexes": {}}
<28>:<add> with open(string, "r", encoding="utf-8", errors="ignore") as file:
<del> with open(string, "r", encoding="utf-8", errors="ignore") as myfile:
<29>:<add> contents = [file.read()]
<del> contents = [myfile.read()]
|
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
<0> if dist is None:
<1> dist = self.distribution
<2> if key is None:
<3> key = self._key
<4> if reverse is None:
<5> reverse = self._reverse
<6> if boundaryless is None:
<7> boundaryless = self.boundaryless
<8>
<9> identify_obj = {"File Signatures": {}, "Regexes": {}}
<10> search = []
<11>
<12> if not only_text and os.path.isdir(text):
<13> # if input is a directory, recursively search for all of the files
<14> for myfile in glob.iglob(text + "/**", recursive=True):
<15> if os.path.isfile(myfile):
<16> search.append(os.path.abspath(myfile))
<17> else:
<18> search = [text]
<19>
<20> for string in search:
<21> if not only_text and os.path.isfile(string):
<22> if os.path.isdir(text):
<23> short_name = string.replace(os.path.abspath(text), "")
<24> else:
<25> short_name = os.path.basename(string)
<26>
<27> magic_numbers = pywhat.magic_numbers.get_magic_nums(string)
<28> with open(string, "r", encoding="utf-8", errors="ignore") as myfile:
<29> contents = [myfile.read()]
<30>
<31> if include_filenames:
<32> contents.append(os.path.basename(string))
<33>
</s>
|
===========below chunk 0===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
# offset: 1
contents, dist=dist, boundaryless=boundaryless
)
if not magic_numbers:
magic_numbers = pywhat.magic_numbers.check_magic_nums(string)
if magic_numbers:
identify_obj["File Signatures"][short_name] = magic_numbers
else:
short_name = "text"
regex = self._regex_id.check(
search, dist=dist, boundaryless=boundaryless
)
if regex:
identify_obj["Regexes"][short_name] = regex
for key_, value in identify_obj.items():
# if there are zero regex or file signature matches, set it to None
if not value:
identify_obj[key_] = None
if key != Keys.NONE:
identify_obj["Regexes"][short_name] = sorted(
identify_obj["Regexes"][short_name], key=key, reverse=reverse
)
return identify_obj
===========unchanged ref 0===========
at: glob
iglob(pathname: AnyStr, *, recursive: bool=...) -> Iterator[AnyStr]
at: io.BufferedRandom
read(self, size: Optional[int]=..., /) -> bytes
at: os.path
isfile(path: AnyPath) -> bool
isdir(s: AnyPath) -> bool
basename(p: _PathLike[AnyStr]) -> AnyStr
basename(p: AnyStr) -> AnyStr
abspath(path: _PathLike[AnyStr]) -> AnyStr
abspath(path: AnyStr) -> AnyStr
abspath = _abspath_fallback
at: pywhat.filter
Filter(filters_dict=None)
Distribution(filter: Optional[Filter]=None)
at: pywhat.helper
Keys()
at: pywhat.identifier.Identifier.__init__
self.distribution = Distribution() if dist is None else dist
self.boundaryless = (
Filter({"Tags": []}) if boundaryless is None else boundaryless
)
self._regex_id = RegexIdentifier()
self._key = key
self._reverse = reverse
at: pywhat.magic_numbers
get_magic_nums(file_loc)
check_magic_nums(text)
at: pywhat.regex_identifier.RegexIdentifier
check(text, dist: Optional[Distribution]=None, *, boundaryless: Optional[Filter]=None)
at: typing
Callable = _CallableType(collections.abc.Callable, 2)
at: typing.IO
__slots__ = ()
read(n: int=...) -> AnyStr
===========changed ref 0===========
# module: pywhat.filter
class Filter(Mapping):
+ def __init__(self, filters_dict=None):
- def __init__(self, filters_dict: Optional[Mapping] = None):
tags = CaseInsensitiveSet(AvailableTags().get_tags())
+ self._dict = {}
- self._dict = dict()
if filters_dict is None:
filters_dict = {}
self._dict["Tags"] = CaseInsensitiveSet(filters_dict.setdefault("Tags", tags))
self._dict["ExcludeTags"] = CaseInsensitiveSet(
filters_dict.setdefault("ExcludeTags", set())
)
# We have regex with 0 rarity which trip false positive alarms all the time
self._dict["MinRarity"] = filters_dict.setdefault("MinRarity", 0.1)
self._dict["MaxRarity"] = filters_dict.setdefault("MaxRarity", 1)
if not self._dict["Tags"].issubset(tags) or not self._dict[
"ExcludeTags"
].issubset(tags):
raise InvalidTag("Passed filter contains tags that are not used by 'what'")
|
tests.test_regex_identifier/test_stackhawk
|
Added
|
bee-san~pyWhat
|
611628724aa518c03c94f383d1387c2bd6111740
|
Fix Python 3.8 and Python 3.9 CI checks (#182)
|
<0>:<add> res = r.check(["hawk.wz6bAoFDwcVQFCD9dofE.w2R1PWI8UTvEM4jd56XQ"])
<add> _assert_match_first_item("StackHawk API Key", res)
<add>
|
# module: tests.test_regex_identifier
+ def test_stackhawk():
<0> <extra_id_1><extra_id_2>
|
===========unchanged ref 0===========
at: pywhat.regex_identifier.RegexIdentifier
check(text, dist: Optional[Distribution]=None, *, boundaryless: Optional[Filter]=None)
at: tests.test_regex_identifier
r = regex_identifier.RegexIdentifier()
_assert_match_first_item(name, res)
===========changed ref 0===========
# module: pywhat.filter
class Filter(Mapping):
+ def __init__(self, filters_dict=None):
- def __init__(self, filters_dict: Optional[Mapping] = None):
tags = CaseInsensitiveSet(AvailableTags().get_tags())
+ self._dict = {}
- self._dict = dict()
if filters_dict is None:
filters_dict = {}
self._dict["Tags"] = CaseInsensitiveSet(filters_dict.setdefault("Tags", tags))
self._dict["ExcludeTags"] = CaseInsensitiveSet(
filters_dict.setdefault("ExcludeTags", set())
)
# We have regex with 0 rarity which trip false positive alarms all the time
self._dict["MinRarity"] = filters_dict.setdefault("MinRarity", 0.1)
self._dict["MaxRarity"] = filters_dict.setdefault("MaxRarity", 1)
if not self._dict["Tags"].issubset(tags) or not self._dict[
"ExcludeTags"
].issubset(tags):
raise InvalidTag("Passed filter contains tags that are not used by 'what'")
===========changed ref 1===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
if dist is None:
dist = self.distribution
if key is None:
key = self._key
if reverse is None:
reverse = self._reverse
if boundaryless is None:
boundaryless = self.boundaryless
+ identify_obj: dict = {"File Signatures": {}, "Regexes": {}}
- identify_obj = {"File Signatures": {}, "Regexes": {}}
search = []
if not only_text and os.path.isdir(text):
# if input is a directory, recursively search for all of the files
for myfile in glob.iglob(text + "/**", recursive=True):
if os.path.isfile(myfile):
search.append(os.path.abspath(myfile))
else:
search = [text]
for string in search:
if not only_text and os.path.isfile(string):
if os.path.isdir(text):
short_name = string.replace(os.path.abspath(text), "")
else:
short_name = os.path.basename(string)
magic_numbers = pywhat.magic_numbers.get_magic_nums(string)
+ with open(string, "r", encoding="utf-8", errors="ignore") as file:
- with open(string, "r", encoding="utf-8", errors="ignore") as myfile:
+ contents = [file.read()]
- contents = [myfile.read()]</s>
===========changed ref 2===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
# offset: 1
<s>") as myfile:
+ contents = [file.read()]
- contents = [myfile.read()]
if include_filenames:
contents.append(os.path.basename(string))
regex = self._regex_id.check(
contents, dist=dist, boundaryless=boundaryless
)
if not magic_numbers:
magic_numbers = pywhat.magic_numbers.check_magic_nums(string)
if magic_numbers:
identify_obj["File Signatures"][short_name] = magic_numbers
else:
short_name = "text"
regex = self._regex_id.check(
search, dist=dist, boundaryless=boundaryless
)
if regex:
identify_obj["Regexes"][short_name] = regex
for key_, value in identify_obj.items():
# if there are zero regex or file signature matches, set it to None
if not value:
identify_obj[key_] = None
if key != Keys.NONE:
identify_obj["Regexes"][short_name] = sorted(
identify_obj["Regexes"][short_name], key=key, reverse=reverse
)
return identify_obj
===========changed ref 3===========
# module: scripts.get_file_sigs
r = requests.get(
"https://en.wikipedia.org/w/index.php?title=" + "List_of_file_signatures&action=raw"
)
wt = wtp.parse(r.text)
# prints first 3 items of json, delete [0:3] to print all.
+ sig_dict = {"root": wt.tables[0].data()}
- to_iter = {"root": wt.tables[0].data()}
+ to_iter = sig_dict["root"]
- to_iter = to_iter["root"]
to_dump = []
populars = {"23 21"}
for i in range(1, len(to_iter)):
to_insert = {}
to_insert["Hexadecimal File Signature"] = cleanhtml(to_iter[i][0]).replace(" ", "")
check_iso = cleanhtml(to_iter[i][1])
if len(set(check_iso)) <= 2:
to_insert["ISO 8859-1"] = None
else:
to_insert["ISO 8859-1"] = check_iso
check = to_iter[i][3]
if check == "":
to_insert["Filename Extension"] = None
else:
to_insert["Filename Extension"] = cleanhtml(check)
des = to_iter[i][4]
if "url" in des:
splits = des.split("=")
if "|" in splits[1]:
# https://wiki.wireshark.org/Development/LibpcapFileFormat#Global_Header|title
split_more = splits[1].split("|")
print(split_more)
to_insert["URL"] = split_more[0]
else:
to_insert["URL"] = splits[1]
to_insert["Description"] = cleanhtml(splits[0])
else</s>
|
tests.test_regex_identifier/test_stackhawk
|
Modified
|
bee-san~pyWhat
|
611628724aa518c03c94f383d1387c2bd6111740
|
Fix Python 3.8 and Python 3.9 CI checks (#182)
|
<0>:<add> res = r.check(["hawk.wz6bAoFDwcVQFCD9dofE.w2R1PWI8UTvEM4jd56XQ"])
<add> _assert_match_first_item("StackHawk API Key", res)
<add>
|
# module: tests.test_regex_identifier
+ def test_stackhawk():
<0> <extra_id_1><extra_id_2>
|
===========unchanged ref 0===========
at: pywhat.regex_identifier.RegexIdentifier
check(text, dist: Optional[Distribution]=None, *, boundaryless: Optional[Filter]=None)
at: tests.test_regex_identifier
r = regex_identifier.RegexIdentifier()
_assert_match_first_item(name, res)
===========changed ref 0===========
# module: tests.test_regex_identifier
+ def test_stackhawk():
+ res = r.check(["hawk.wz6bAoFDwcVQFCD9dofE.w2R1PWI8UTvEM4jd56XQ"])
+ _assert_match_first_item("StackHawk API Key", res)
+
===========changed ref 1===========
# module: pywhat.filter
class Filter(Mapping):
+ def __init__(self, filters_dict=None):
- def __init__(self, filters_dict: Optional[Mapping] = None):
tags = CaseInsensitiveSet(AvailableTags().get_tags())
+ self._dict = {}
- self._dict = dict()
if filters_dict is None:
filters_dict = {}
self._dict["Tags"] = CaseInsensitiveSet(filters_dict.setdefault("Tags", tags))
self._dict["ExcludeTags"] = CaseInsensitiveSet(
filters_dict.setdefault("ExcludeTags", set())
)
# We have regex with 0 rarity which trip false positive alarms all the time
self._dict["MinRarity"] = filters_dict.setdefault("MinRarity", 0.1)
self._dict["MaxRarity"] = filters_dict.setdefault("MaxRarity", 1)
if not self._dict["Tags"].issubset(tags) or not self._dict[
"ExcludeTags"
].issubset(tags):
raise InvalidTag("Passed filter contains tags that are not used by 'what'")
===========changed ref 2===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
if dist is None:
dist = self.distribution
if key is None:
key = self._key
if reverse is None:
reverse = self._reverse
if boundaryless is None:
boundaryless = self.boundaryless
+ identify_obj: dict = {"File Signatures": {}, "Regexes": {}}
- identify_obj = {"File Signatures": {}, "Regexes": {}}
search = []
if not only_text and os.path.isdir(text):
# if input is a directory, recursively search for all of the files
for myfile in glob.iglob(text + "/**", recursive=True):
if os.path.isfile(myfile):
search.append(os.path.abspath(myfile))
else:
search = [text]
for string in search:
if not only_text and os.path.isfile(string):
if os.path.isdir(text):
short_name = string.replace(os.path.abspath(text), "")
else:
short_name = os.path.basename(string)
magic_numbers = pywhat.magic_numbers.get_magic_nums(string)
+ with open(string, "r", encoding="utf-8", errors="ignore") as file:
- with open(string, "r", encoding="utf-8", errors="ignore") as myfile:
+ contents = [file.read()]
- contents = [myfile.read()]</s>
===========changed ref 3===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
# offset: 1
<s>") as myfile:
+ contents = [file.read()]
- contents = [myfile.read()]
if include_filenames:
contents.append(os.path.basename(string))
regex = self._regex_id.check(
contents, dist=dist, boundaryless=boundaryless
)
if not magic_numbers:
magic_numbers = pywhat.magic_numbers.check_magic_nums(string)
if magic_numbers:
identify_obj["File Signatures"][short_name] = magic_numbers
else:
short_name = "text"
regex = self._regex_id.check(
search, dist=dist, boundaryless=boundaryless
)
if regex:
identify_obj["Regexes"][short_name] = regex
for key_, value in identify_obj.items():
# if there are zero regex or file signature matches, set it to None
if not value:
identify_obj[key_] = None
if key != Keys.NONE:
identify_obj["Regexes"][short_name] = sorted(
identify_obj["Regexes"][short_name], key=key, reverse=reverse
)
return identify_obj
===========changed ref 4===========
# module: scripts.get_file_sigs
r = requests.get(
"https://en.wikipedia.org/w/index.php?title=" + "List_of_file_signatures&action=raw"
)
wt = wtp.parse(r.text)
# prints first 3 items of json, delete [0:3] to print all.
+ sig_dict = {"root": wt.tables[0].data()}
- to_iter = {"root": wt.tables[0].data()}
+ to_iter = sig_dict["root"]
- to_iter = to_iter["root"]
to_dump = []
populars = {"23 21"}
for i in range(1, len(to_iter)):
to_insert = {}
to_insert["Hexadecimal File Signature"] = cleanhtml(to_iter[i][0]).replace(" ", "")
check_iso = cleanhtml(to_iter[i][1])
if len(set(check_iso)) <= 2:
to_insert["ISO 8859-1"] = None
else:
to_insert["ISO 8859-1"] = check_iso
check = to_iter[i][3]
if check == "":
to_insert["Filename Extension"] = None
else:
to_insert["Filename Extension"] = cleanhtml(check)
des = to_iter[i][4]
if "url" in des:
splits = des.split("=")
if "|" in splits[1]:
# https://wiki.wireshark.org/Development/LibpcapFileFormat#Global_Header|title
split_more = splits[1].split("|")
print(split_more)
to_insert["URL"] = split_more[0]
else:
to_insert["URL"] = splits[1]
to_insert["Description"] = cleanhtml(splits[0])
else</s>
|
tests.test_regex_identifier/test_stripe_api_key
|
Modified
|
bee-san~pyWhat
|
611628724aa518c03c94f383d1387c2bd6111740
|
Fix Python 3.8 and Python 3.9 CI checks (#182)
|
<0>:<add> res = r.check(["sk_live_vHDDrL02ioRF5vYtyqiYBKma"])
<del> res = r.check(["sk_live_26PHem9AhJZvU623DfE1x4sd"])
|
# module: tests.test_regex_identifier
def test_stripe_api_key():
<0> res = r.check(["sk_live_26PHem9AhJZvU623DfE1x4sd"])
<1> _assert_match_first_item("Stripe API Key", res)
<2>
|
===========unchanged ref 0===========
at: pywhat.regex_identifier.RegexIdentifier
check(text, dist: Optional[Distribution]=None, *, boundaryless: Optional[Filter]=None)
at: tests.test_regex_identifier
r = regex_identifier.RegexIdentifier()
_assert_match_first_item(name, res)
===========changed ref 0===========
# module: tests.test_regex_identifier
+ def test_stackhawk():
+ res = r.check(["hawk.wz6bAoFDwcVQFCD9dofE.w2R1PWI8UTvEM4jd56XQ"])
+ _assert_match_first_item("StackHawk API Key", res)
+
===========changed ref 1===========
# module: tests.test_regex_identifier
+ def test_stackhawk():
+ res = r.check(["hawk.wz6bAoFDwcVQFCD9dofE.w2R1PWI8UTvEM4jd56XQ"])
+ _assert_match_first_item("StackHawk API Key", res)
+
===========changed ref 2===========
# module: pywhat.filter
class Filter(Mapping):
+ def __init__(self, filters_dict=None):
- def __init__(self, filters_dict: Optional[Mapping] = None):
tags = CaseInsensitiveSet(AvailableTags().get_tags())
+ self._dict = {}
- self._dict = dict()
if filters_dict is None:
filters_dict = {}
self._dict["Tags"] = CaseInsensitiveSet(filters_dict.setdefault("Tags", tags))
self._dict["ExcludeTags"] = CaseInsensitiveSet(
filters_dict.setdefault("ExcludeTags", set())
)
# We have regex with 0 rarity which trip false positive alarms all the time
self._dict["MinRarity"] = filters_dict.setdefault("MinRarity", 0.1)
self._dict["MaxRarity"] = filters_dict.setdefault("MaxRarity", 1)
if not self._dict["Tags"].issubset(tags) or not self._dict[
"ExcludeTags"
].issubset(tags):
raise InvalidTag("Passed filter contains tags that are not used by 'what'")
===========changed ref 3===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
if dist is None:
dist = self.distribution
if key is None:
key = self._key
if reverse is None:
reverse = self._reverse
if boundaryless is None:
boundaryless = self.boundaryless
+ identify_obj: dict = {"File Signatures": {}, "Regexes": {}}
- identify_obj = {"File Signatures": {}, "Regexes": {}}
search = []
if not only_text and os.path.isdir(text):
# if input is a directory, recursively search for all of the files
for myfile in glob.iglob(text + "/**", recursive=True):
if os.path.isfile(myfile):
search.append(os.path.abspath(myfile))
else:
search = [text]
for string in search:
if not only_text and os.path.isfile(string):
if os.path.isdir(text):
short_name = string.replace(os.path.abspath(text), "")
else:
short_name = os.path.basename(string)
magic_numbers = pywhat.magic_numbers.get_magic_nums(string)
+ with open(string, "r", encoding="utf-8", errors="ignore") as file:
- with open(string, "r", encoding="utf-8", errors="ignore") as myfile:
+ contents = [file.read()]
- contents = [myfile.read()]</s>
===========changed ref 4===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
# offset: 1
<s>") as myfile:
+ contents = [file.read()]
- contents = [myfile.read()]
if include_filenames:
contents.append(os.path.basename(string))
regex = self._regex_id.check(
contents, dist=dist, boundaryless=boundaryless
)
if not magic_numbers:
magic_numbers = pywhat.magic_numbers.check_magic_nums(string)
if magic_numbers:
identify_obj["File Signatures"][short_name] = magic_numbers
else:
short_name = "text"
regex = self._regex_id.check(
search, dist=dist, boundaryless=boundaryless
)
if regex:
identify_obj["Regexes"][short_name] = regex
for key_, value in identify_obj.items():
# if there are zero regex or file signature matches, set it to None
if not value:
identify_obj[key_] = None
if key != Keys.NONE:
identify_obj["Regexes"][short_name] = sorted(
identify_obj["Regexes"][short_name], key=key, reverse=reverse
)
return identify_obj
|
noxfile/tests
|
Modified
|
bee-san~pyWhat
|
611628724aa518c03c94f383d1387c2bd6111740
|
Fix Python 3.8 and Python 3.9 CI checks (#182)
|
<2>:<add> install_with_constraints(
<add> session,
<add> "pytest",
<add> "pytest-black",
<add> "pytest-isort",
<add> "pytest-mypy",
<add> "types-requests",
<add> "types-orjson",
<add> )
<del> install_with_constraints(session, "pytest", "pytest-black", "pytest-isort")
|
# module: noxfile
+ @nox.session
- @nox.session(python=["3.8", "3.7"])
def tests(session: Session) -> None:
<0> """Run the test suite."""
<1> session.run("poetry", "install", "--no-dev", external=True)
<2> install_with_constraints(session, "pytest", "pytest-black", "pytest-isort")
<3> session.run("pytest")
<4>
|
===========changed ref 0===========
# module: noxfile
-
-
- @nox.session(python=["3.8", "3.7"])
- def lint(session: Session) -> None:
- pass
-
===========changed ref 1===========
# module: noxfile
-
-
- @nox.session(python="3.8")
- def black(session: Session) -> None:
- """Run black code formatter."""
- args = session.posargs or locations
- install_with_constraints(session, "black")
- session.run("black", *args)
-
===========changed ref 2===========
# module: noxfile
- package = "hypermodern_python"
+ nox.options.sessions = ["tests"]
- nox.options.sessions = "lint", "tests"
locations = "src", "tests", "noxfile.py", "docs/conf.py"
===========changed ref 3===========
# module: tests.test_regex_identifier
+ def test_stackhawk():
+ res = r.check(["hawk.wz6bAoFDwcVQFCD9dofE.w2R1PWI8UTvEM4jd56XQ"])
+ _assert_match_first_item("StackHawk API Key", res)
+
===========changed ref 4===========
# module: tests.test_regex_identifier
+ def test_stackhawk():
+ res = r.check(["hawk.wz6bAoFDwcVQFCD9dofE.w2R1PWI8UTvEM4jd56XQ"])
+ _assert_match_first_item("StackHawk API Key", res)
+
===========changed ref 5===========
# module: tests.test_regex_identifier
def test_stripe_api_key():
+ res = r.check(["sk_live_vHDDrL02ioRF5vYtyqiYBKma"])
- res = r.check(["sk_live_26PHem9AhJZvU623DfE1x4sd"])
_assert_match_first_item("Stripe API Key", res)
===========changed ref 6===========
# module: pywhat.filter
class Filter(Mapping):
+ def __init__(self, filters_dict=None):
- def __init__(self, filters_dict: Optional[Mapping] = None):
tags = CaseInsensitiveSet(AvailableTags().get_tags())
+ self._dict = {}
- self._dict = dict()
if filters_dict is None:
filters_dict = {}
self._dict["Tags"] = CaseInsensitiveSet(filters_dict.setdefault("Tags", tags))
self._dict["ExcludeTags"] = CaseInsensitiveSet(
filters_dict.setdefault("ExcludeTags", set())
)
# We have regex with 0 rarity which trip false positive alarms all the time
self._dict["MinRarity"] = filters_dict.setdefault("MinRarity", 0.1)
self._dict["MaxRarity"] = filters_dict.setdefault("MaxRarity", 1)
if not self._dict["Tags"].issubset(tags) or not self._dict[
"ExcludeTags"
].issubset(tags):
raise InvalidTag("Passed filter contains tags that are not used by 'what'")
===========changed ref 7===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
if dist is None:
dist = self.distribution
if key is None:
key = self._key
if reverse is None:
reverse = self._reverse
if boundaryless is None:
boundaryless = self.boundaryless
+ identify_obj: dict = {"File Signatures": {}, "Regexes": {}}
- identify_obj = {"File Signatures": {}, "Regexes": {}}
search = []
if not only_text and os.path.isdir(text):
# if input is a directory, recursively search for all of the files
for myfile in glob.iglob(text + "/**", recursive=True):
if os.path.isfile(myfile):
search.append(os.path.abspath(myfile))
else:
search = [text]
for string in search:
if not only_text and os.path.isfile(string):
if os.path.isdir(text):
short_name = string.replace(os.path.abspath(text), "")
else:
short_name = os.path.basename(string)
magic_numbers = pywhat.magic_numbers.get_magic_nums(string)
+ with open(string, "r", encoding="utf-8", errors="ignore") as file:
- with open(string, "r", encoding="utf-8", errors="ignore") as myfile:
+ contents = [file.read()]
- contents = [myfile.read()]</s>
===========changed ref 8===========
# module: pywhat.identifier
class Identifier:
def identify(
self,
text: str,
*,
only_text=True,
dist: Distribution = None,
key: Optional[Callable] = None,
reverse: Optional[bool] = None,
boundaryless: Optional[Filter] = None,
include_filenames=False,
) -> dict:
# offset: 1
<s>") as myfile:
+ contents = [file.read()]
- contents = [myfile.read()]
if include_filenames:
contents.append(os.path.basename(string))
regex = self._regex_id.check(
contents, dist=dist, boundaryless=boundaryless
)
if not magic_numbers:
magic_numbers = pywhat.magic_numbers.check_magic_nums(string)
if magic_numbers:
identify_obj["File Signatures"][short_name] = magic_numbers
else:
short_name = "text"
regex = self._regex_id.check(
search, dist=dist, boundaryless=boundaryless
)
if regex:
identify_obj["Regexes"][short_name] = regex
for key_, value in identify_obj.items():
# if there are zero regex or file signature matches, set it to None
if not value:
identify_obj[key_] = None
if key != Keys.NONE:
identify_obj["Regexes"][short_name] = sorted(
identify_obj["Regexes"][short_name], key=key, reverse=reverse
)
return identify_obj
|
tests.test_regex_identifier/test_pypi_upload_token
|
Modified
|
bee-san~pyWhat
|
808806fb957ef27fb71eb11b396e6a840dcc96ec
|
Add numerous new tags (#183)
|
<5>:<add> _assert_match_first_item("PyPI Upload Token", res)
<del> _assert_match_first_item("PyPi Upload Token", res)
|
# module: tests.test_regex_identifier
def test_pypi_upload_token():
<0> res = r.check(
<1> [
<2> "pypi-AgEIcHlwaS5vcmcCJDZlNzEyNGJmLWQ4N2UtNGZhYS1iNWEzLWQzYzg2YjU3NzAxYgACJXsicGVybWlzc2lvbnMiOiAidXNlciIsICJ2ZXJzaW9uIjogMX0AAAYgeYcgrZO31PTS_3ipsd0fTSMy1kVkxCzhQvHN6m97yIE"
<3> ]
<4> )
<5> _assert_match_first_item("PyPi Upload Token", res)
<6>
|
===========unchanged ref 0===========
at: pywhat.regex_identifier.RegexIdentifier
check(text, dist: Optional[Distribution]=None, *, boundaryless: Optional[Filter]=None)
at: tests.test_regex_identifier
r = regex_identifier.RegexIdentifier()
_assert_match_first_item(name, res)
|
noxfile/tests
|
Modified
|
bee-san~pyWhat
|
1ccbfa99736fac8ee129d0e6ca4e1c96b61397e6
|
Merge branch 'main' into coverage
|
<6>:<add> "pytest-cov",
<11>:<add> session.run("pytest", "--cov=./", "--cov-report=xml")
<del> session.run("pytest")
|
# module: noxfile
@nox.session
def tests(session: Session) -> None:
<0> """Run the test suite."""
<1> session.run("poetry", "install", "--no-dev", external=True)
<2> install_with_constraints(
<3> session,
<4> "pytest",
<5> "pytest-black",
<6> "pytest-isort",
<7> "pytest-mypy",
<8> "types-requests",
<9> "types-orjson",
<10> )
<11> session.run("pytest")
<12>
|
===========unchanged ref 0===========
at: noxfile
install_with_constraints(session: Session, *args: str, **kwargs: Any) -> None
===========changed ref 0===========
# module: noxfile
nox.options.sessions = ["tests"]
+ if environ.get("CI", None) == "true":
+ nox.options.sessions.append("coverage")
locations = "src", "tests", "noxfile.py", "docs/conf.py"
|
tests.test_click/test_file_fixture_turkish_car_plate
|
Modified
|
bee-san~pyWhat
|
8b2a4e777457ac9716d084d06e080a6beb4cd9c9
|
Set some regex to 0
|
<1>:<add> result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
<del> result = runner.invoke(main, ["fixtures/file"])
|
# module: tests.test_click
def test_file_fixture_turkish_car_plate():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["fixtures/file"])
<2> assert result.exit_code == 0
<3> assert re.findall("Turkish License Plate Number", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: click.testing.Result.__init__
self.exit_code = exit_code
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
===========changed ref 0===========
# module: pywhat
+ __version__ = "4.3.1"
- __version__ = "4.3.0"
tags = AvailableTags().get_tags()
pywhat_tags = tags # left for backward compatibility purposes
_contents = ["Identifier", "Distribution", "tags", "pywhat_tags", "Keys", "Filter"]
__all__ = _contents
del AvailableTags, filter
|
tests.test_click/test_file_fixture_turkish_tax_number
|
Modified
|
bee-san~pyWhat
|
8b2a4e777457ac9716d084d06e080a6beb4cd9c9
|
Set some regex to 0
|
<1>:<add> result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
<del> result = runner.invoke(main, ["fixtures/file"])
|
# module: tests.test_click
def test_file_fixture_turkish_tax_number():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["fixtures/file"])
<2> assert result.exit_code == 0
<3> assert re.findall("Turkish Tax Number", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: click.testing.Result.__init__
self.exit_code = exit_code
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
===========changed ref 0===========
# module: tests.test_click
def test_file_fixture_turkish_car_plate():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish License Plate Number", str(result.output))
===========changed ref 1===========
# module: pywhat
+ __version__ = "4.3.1"
- __version__ = "4.3.0"
tags = AvailableTags().get_tags()
pywhat_tags = tags # left for backward compatibility purposes
_contents = ["Identifier", "Distribution", "tags", "pywhat_tags", "Keys", "Filter"]
__all__ = _contents
del AvailableTags, filter
|
tests.test_click/test_file_fixture_objectid
|
Modified
|
bee-san~pyWhat
|
8b2a4e777457ac9716d084d06e080a6beb4cd9c9
|
Set some regex to 0
|
<1>:<add> result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
<del> result = runner.invoke(main, ["fixtures/file"])
|
# module: tests.test_click
def test_file_fixture_objectid():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["fixtures/file"])
<2> assert result.exit_code == 0
<3> assert re.findall("ObjectID", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: click.testing.Result.__init__
self.exit_code = exit_code
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
===========changed ref 0===========
# module: tests.test_click
def test_file_fixture_turkish_tax_number():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish Tax Number", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_file_fixture_turkish_car_plate():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish License Plate Number", str(result.output))
===========changed ref 2===========
# module: pywhat
+ __version__ = "4.3.1"
- __version__ = "4.3.0"
tags = AvailableTags().get_tags()
pywhat_tags = tags # left for backward compatibility purposes
_contents = ["Identifier", "Distribution", "tags", "pywhat_tags", "Keys", "Filter"]
__all__ = _contents
del AvailableTags, filter
|
tests.test_click/test_file_fixture_ulid
|
Modified
|
bee-san~pyWhat
|
8b2a4e777457ac9716d084d06e080a6beb4cd9c9
|
Set some regex to 0
|
<1>:<add> result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
<del> result = runner.invoke(main, ["fixtures/file"])
|
# module: tests.test_click
def test_file_fixture_ulid():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["fixtures/file"])
<2> assert result.exit_code == 0
<3> assert re.findall("ULID", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: click.testing.Result.__init__
self.exit_code = exit_code
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
===========changed ref 0===========
# module: tests.test_click
def test_file_fixture_objectid():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ObjectID", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_file_fixture_turkish_tax_number():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish Tax Number", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_file_fixture_turkish_car_plate():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish License Plate Number", str(result.output))
===========changed ref 3===========
# module: pywhat
+ __version__ = "4.3.1"
- __version__ = "4.3.0"
tags = AvailableTags().get_tags()
pywhat_tags = tags # left for backward compatibility purposes
_contents = ["Identifier", "Distribution", "tags", "pywhat_tags", "Keys", "Filter"]
__all__ = _contents
del AvailableTags, filter
|
tests.test_regex_identifier/test_youtube_id
|
Modified
|
bee-san~pyWhat
|
8b2a4e777457ac9716d084d06e080a6beb4cd9c9
|
Set some regex to 0
|
<0>:<add> res = r.check(["dQw4w9WgXcQ"], dist=d)
<del> res = r.check(["dQw4w9WgXcQ"])
|
# module: tests.test_regex_identifier
def test_youtube_id():
<0> res = r.check(["dQw4w9WgXcQ"])
<1> _assert_match_first_item("YouTube Video ID", res)
<2>
|
===========unchanged ref 0===========
at: tests.test_regex_identifier
_assert_match_first_item(name, res)
at: tests.test_regex_identifier.test_youtube2
res = r.check(["http://www.youtube.com/watch?v=dQw4w9WgXcQ"])
===========changed ref 0===========
# module: tests.test_regex_identifier
database = load_regexes()
r = regex_identifier.RegexIdentifier()
+ filter1 = Filter({"MinRarity": 0.0})
+ d = Distribution(filter1)
+ r_rarity_0 = regex_identifier.RegexIdentifier()
===========changed ref 1===========
# module: tests.test_click
def test_file_fixture_objectid():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ObjectID", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_file_fixture_ulid():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ULID", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_file_fixture_turkish_tax_number():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish Tax Number", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_file_fixture_turkish_car_plate():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish License Plate Number", str(result.output))
===========changed ref 5===========
# module: pywhat
+ __version__ = "4.3.1"
- __version__ = "4.3.0"
tags = AvailableTags().get_tags()
pywhat_tags = tags # left for backward compatibility purposes
_contents = ["Identifier", "Distribution", "tags", "pywhat_tags", "Keys", "Filter"]
__all__ = _contents
del AvailableTags, filter
|
tests.test_regex_identifier/test_youtube_id2
|
Modified
|
bee-san~pyWhat
|
8b2a4e777457ac9716d084d06e080a6beb4cd9c9
|
Set some regex to 0
|
<0>:<add> res = r.check(["078-05-1120"], dist=d)
<del> res = r.check(["078-05-1120"])
|
# module: tests.test_regex_identifier
def test_youtube_id2():
<0> res = r.check(["078-05-1120"])
<1> assert "YouTube Video ID" not in res
<2>
|
===========unchanged ref 0===========
at: tests.test_regex_identifier
_assert_match_first_item(name, res)
at: tests.test_regex_identifier.test_youtube_id
res = r.check(["dQw4w9WgXcQ"], dist=d)
===========changed ref 0===========
# module: tests.test_regex_identifier
def test_youtube_id():
+ res = r.check(["dQw4w9WgXcQ"], dist=d)
- res = r.check(["dQw4w9WgXcQ"])
_assert_match_first_item("YouTube Video ID", res)
===========changed ref 1===========
# module: tests.test_regex_identifier
database = load_regexes()
r = regex_identifier.RegexIdentifier()
+ filter1 = Filter({"MinRarity": 0.0})
+ d = Distribution(filter1)
+ r_rarity_0 = regex_identifier.RegexIdentifier()
===========changed ref 2===========
# module: tests.test_click
def test_file_fixture_objectid():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ObjectID", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_file_fixture_ulid():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ULID", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_file_fixture_turkish_tax_number():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish Tax Number", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_file_fixture_turkish_car_plate():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish License Plate Number", str(result.output))
===========changed ref 6===========
# module: pywhat
+ __version__ = "4.3.1"
- __version__ = "4.3.0"
tags = AvailableTags().get_tags()
pywhat_tags = tags # left for backward compatibility purposes
_contents = ["Identifier", "Distribution", "tags", "pywhat_tags", "Keys", "Filter"]
__all__ = _contents
del AvailableTags, filter
|
tests.test_regex_identifier/test_unix_timestamp
|
Modified
|
bee-san~pyWhat
|
8b2a4e777457ac9716d084d06e080a6beb4cd9c9
|
Set some regex to 0
|
<0>:<add> res = r.check(["1577836800"], dist=d) # 2020-01-01
<del> res = r.check(["1577836800"]) # 2020-01-01
|
# module: tests.test_regex_identifier
def test_unix_timestamp():
<0> res = r.check(["1577836800"]) # 2020-01-01
<1> keys = [m["Regex Pattern"]["Name"] for m in res]
<2> assert "Unix Timestamp" in keys
<3> assert "Recent Unix Timestamp" in keys
<4>
|
===========unchanged ref 0===========
at: pywhat.regex_identifier.RegexIdentifier
check(text, dist: Optional[Distribution]=None, *, boundaryless: Optional[Filter]=None)
at: tests.test_regex_identifier
r = regex_identifier.RegexIdentifier()
d = Distribution(filter1)
_assert_match_first_item(name, res)
at: tests.test_regex_identifier.test_arn4
res = r.check(["arn:aws:s3:::my_corporate_bucket/Development/*"])
===========changed ref 0===========
# module: tests.test_regex_identifier
def test_youtube_id2():
+ res = r.check(["078-05-1120"], dist=d)
- res = r.check(["078-05-1120"])
assert "YouTube Video ID" not in res
===========changed ref 1===========
# module: tests.test_regex_identifier
def test_youtube_id():
+ res = r.check(["dQw4w9WgXcQ"], dist=d)
- res = r.check(["dQw4w9WgXcQ"])
_assert_match_first_item("YouTube Video ID", res)
===========changed ref 2===========
# module: tests.test_regex_identifier
database = load_regexes()
r = regex_identifier.RegexIdentifier()
+ filter1 = Filter({"MinRarity": 0.0})
+ d = Distribution(filter1)
+ r_rarity_0 = regex_identifier.RegexIdentifier()
===========changed ref 3===========
# module: tests.test_click
def test_file_fixture_objectid():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ObjectID", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_file_fixture_ulid():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ULID", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_file_fixture_turkish_tax_number():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish Tax Number", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_file_fixture_turkish_car_plate():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish License Plate Number", str(result.output))
===========changed ref 7===========
# module: pywhat
+ __version__ = "4.3.1"
- __version__ = "4.3.0"
tags = AvailableTags().get_tags()
pywhat_tags = tags # left for backward compatibility purposes
_contents = ["Identifier", "Distribution", "tags", "pywhat_tags", "Keys", "Filter"]
__all__ = _contents
del AvailableTags, filter
|
tests.test_regex_identifier/test_unix_timestamp2
|
Modified
|
bee-san~pyWhat
|
8b2a4e777457ac9716d084d06e080a6beb4cd9c9
|
Set some regex to 0
|
<0>:<add> res = r.check(["94694400"], dist=d) # 1973-01-01
<del> res = r.check(["94694400"]) # 1973-01-01
|
# module: tests.test_regex_identifier
def test_unix_timestamp2():
<0> res = r.check(["94694400"]) # 1973-01-01
<1> keys = [m["Regex Pattern"]["Name"] for m in res]
<2> assert "Unix Timestamp" in keys
<3> assert "Recent Unix Timestamp" not in keys
<4>
|
===========unchanged ref 0===========
at: pywhat.regex_identifier.RegexIdentifier
check(text, dist: Optional[Distribution]=None, *, boundaryless: Optional[Filter]=None)
at: tests.test_regex_identifier
r = regex_identifier.RegexIdentifier()
d = Distribution(filter1)
at: tests.test_regex_identifier.test_unix_timestamp
keys = [m["Regex Pattern"]["Name"] for m in res]
===========changed ref 0===========
# module: tests.test_regex_identifier
def test_unix_timestamp():
+ res = r.check(["1577836800"], dist=d) # 2020-01-01
- res = r.check(["1577836800"]) # 2020-01-01
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Timestamp" in keys
assert "Recent Unix Timestamp" in keys
===========changed ref 1===========
# module: tests.test_regex_identifier
def test_youtube_id2():
+ res = r.check(["078-05-1120"], dist=d)
- res = r.check(["078-05-1120"])
assert "YouTube Video ID" not in res
===========changed ref 2===========
# module: tests.test_regex_identifier
def test_youtube_id():
+ res = r.check(["dQw4w9WgXcQ"], dist=d)
- res = r.check(["dQw4w9WgXcQ"])
_assert_match_first_item("YouTube Video ID", res)
===========changed ref 3===========
# module: tests.test_regex_identifier
database = load_regexes()
r = regex_identifier.RegexIdentifier()
+ filter1 = Filter({"MinRarity": 0.0})
+ d = Distribution(filter1)
+ r_rarity_0 = regex_identifier.RegexIdentifier()
===========changed ref 4===========
# module: tests.test_click
def test_file_fixture_objectid():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ObjectID", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_file_fixture_ulid():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ULID", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_file_fixture_turkish_tax_number():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish Tax Number", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_file_fixture_turkish_car_plate():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish License Plate Number", str(result.output))
===========changed ref 8===========
# module: pywhat
+ __version__ = "4.3.1"
- __version__ = "4.3.0"
tags = AvailableTags().get_tags()
pywhat_tags = tags # left for backward compatibility purposes
_contents = ["Identifier", "Distribution", "tags", "pywhat_tags", "Keys", "Filter"]
__all__ = _contents
del AvailableTags, filter
|
tests.test_regex_identifier/test_unix_timestamp3
|
Modified
|
bee-san~pyWhat
|
8b2a4e777457ac9716d084d06e080a6beb4cd9c9
|
Set some regex to 0
|
<0>:<add> res = r.check(["1234567"], dist=d) # 7 numbers
<del> res = r.check(["1234567"]) # 7 numbers
|
# module: tests.test_regex_identifier
def test_unix_timestamp3():
<0> res = r.check(["1234567"]) # 7 numbers
<1> keys = [m["Regex Pattern"]["Name"] for m in res]
<2> assert "Unix Timestamp" not in keys
<3> assert "Recent Unix Timestamp" not in keys
<4>
|
===========unchanged ref 0===========
at: pywhat.regex_identifier.RegexIdentifier
check(text, dist: Optional[Distribution]=None, *, boundaryless: Optional[Filter]=None)
at: tests.test_regex_identifier
r = regex_identifier.RegexIdentifier()
d = Distribution(filter1)
at: tests.test_regex_identifier.test_unix_timestamp2
keys = [m["Regex Pattern"]["Name"] for m in res]
===========changed ref 0===========
# module: tests.test_regex_identifier
def test_unix_timestamp2():
+ res = r.check(["94694400"], dist=d) # 1973-01-01
- res = r.check(["94694400"]) # 1973-01-01
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Timestamp" in keys
assert "Recent Unix Timestamp" not in keys
===========changed ref 1===========
# module: tests.test_regex_identifier
def test_unix_timestamp():
+ res = r.check(["1577836800"], dist=d) # 2020-01-01
- res = r.check(["1577836800"]) # 2020-01-01
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Timestamp" in keys
assert "Recent Unix Timestamp" in keys
===========changed ref 2===========
# module: tests.test_regex_identifier
def test_youtube_id2():
+ res = r.check(["078-05-1120"], dist=d)
- res = r.check(["078-05-1120"])
assert "YouTube Video ID" not in res
===========changed ref 3===========
# module: tests.test_regex_identifier
def test_youtube_id():
+ res = r.check(["dQw4w9WgXcQ"], dist=d)
- res = r.check(["dQw4w9WgXcQ"])
_assert_match_first_item("YouTube Video ID", res)
===========changed ref 4===========
# module: tests.test_regex_identifier
database = load_regexes()
r = regex_identifier.RegexIdentifier()
+ filter1 = Filter({"MinRarity": 0.0})
+ d = Distribution(filter1)
+ r_rarity_0 = regex_identifier.RegexIdentifier()
===========changed ref 5===========
# module: tests.test_click
def test_file_fixture_objectid():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ObjectID", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_file_fixture_ulid():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ULID", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_file_fixture_turkish_tax_number():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish Tax Number", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_file_fixture_turkish_car_plate():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish License Plate Number", str(result.output))
===========changed ref 9===========
# module: pywhat
+ __version__ = "4.3.1"
- __version__ = "4.3.0"
tags = AvailableTags().get_tags()
pywhat_tags = tags # left for backward compatibility purposes
_contents = ["Identifier", "Distribution", "tags", "pywhat_tags", "Keys", "Filter"]
__all__ = _contents
del AvailableTags, filter
|
tests.test_regex_identifier/test_unix_timestamp4
|
Modified
|
bee-san~pyWhat
|
8b2a4e777457ac9716d084d06e080a6beb4cd9c9
|
Set some regex to 0
|
<0>:<add> res = r.check(["1577836800000"], dist=d) # 2020-01-01
<del> res = r.check(["1577836800000"]) # 2020-01-01
|
# module: tests.test_regex_identifier
def test_unix_timestamp4():
<0> res = r.check(["1577836800000"]) # 2020-01-01
<1> keys = [m["Regex Pattern"]["Name"] for m in res]
<2> assert "Unix Millisecond Timestamp" in keys
<3> assert "Recent Unix Millisecond Timestamp" in keys
<4>
|
===========unchanged ref 0===========
at: pywhat.regex_identifier.RegexIdentifier
check(text, dist: Optional[Distribution]=None, *, boundaryless: Optional[Filter]=None)
at: tests.test_regex_identifier
r = regex_identifier.RegexIdentifier()
d = Distribution(filter1)
at: tests.test_regex_identifier.test_unix_timestamp3
keys = [m["Regex Pattern"]["Name"] for m in res]
===========changed ref 0===========
# module: tests.test_regex_identifier
def test_unix_timestamp3():
+ res = r.check(["1234567"], dist=d) # 7 numbers
- res = r.check(["1234567"]) # 7 numbers
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Timestamp" not in keys
assert "Recent Unix Timestamp" not in keys
===========changed ref 1===========
# module: tests.test_regex_identifier
def test_unix_timestamp2():
+ res = r.check(["94694400"], dist=d) # 1973-01-01
- res = r.check(["94694400"]) # 1973-01-01
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Timestamp" in keys
assert "Recent Unix Timestamp" not in keys
===========changed ref 2===========
# module: tests.test_regex_identifier
def test_unix_timestamp():
+ res = r.check(["1577836800"], dist=d) # 2020-01-01
- res = r.check(["1577836800"]) # 2020-01-01
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Timestamp" in keys
assert "Recent Unix Timestamp" in keys
===========changed ref 3===========
# module: tests.test_regex_identifier
def test_youtube_id2():
+ res = r.check(["078-05-1120"], dist=d)
- res = r.check(["078-05-1120"])
assert "YouTube Video ID" not in res
===========changed ref 4===========
# module: tests.test_regex_identifier
def test_youtube_id():
+ res = r.check(["dQw4w9WgXcQ"], dist=d)
- res = r.check(["dQw4w9WgXcQ"])
_assert_match_first_item("YouTube Video ID", res)
===========changed ref 5===========
# module: tests.test_regex_identifier
database = load_regexes()
r = regex_identifier.RegexIdentifier()
+ filter1 = Filter({"MinRarity": 0.0})
+ d = Distribution(filter1)
+ r_rarity_0 = regex_identifier.RegexIdentifier()
===========changed ref 6===========
# module: tests.test_click
def test_file_fixture_objectid():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ObjectID", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_file_fixture_ulid():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ULID", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_file_fixture_turkish_tax_number():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish Tax Number", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_file_fixture_turkish_car_plate():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish License Plate Number", str(result.output))
===========changed ref 10===========
# module: pywhat
+ __version__ = "4.3.1"
- __version__ = "4.3.0"
tags = AvailableTags().get_tags()
pywhat_tags = tags # left for backward compatibility purposes
_contents = ["Identifier", "Distribution", "tags", "pywhat_tags", "Keys", "Filter"]
__all__ = _contents
del AvailableTags, filter
|
tests.test_regex_identifier/test_unix_timestamp5
|
Modified
|
bee-san~pyWhat
|
8b2a4e777457ac9716d084d06e080a6beb4cd9c9
|
Set some regex to 0
|
<0>:<add> res = r.check(["94694400000"], dist=d) # 1973-01-01
<del> res = r.check(["94694400000"]) # 1973-01-01
|
# module: tests.test_regex_identifier
def test_unix_timestamp5():
<0> res = r.check(["94694400000"]) # 1973-01-01
<1> keys = [m["Regex Pattern"]["Name"] for m in res]
<2> assert "Unix Millisecond Timestamp" in keys
<3> assert "Recent Unix Millisecond Timestamp" not in keys
<4>
|
===========unchanged ref 0===========
at: pywhat.regex_identifier.RegexIdentifier
check(text, dist: Optional[Distribution]=None, *, boundaryless: Optional[Filter]=None)
at: tests.test_regex_identifier
r = regex_identifier.RegexIdentifier()
d = Distribution(filter1)
at: tests.test_regex_identifier.test_unix_timestamp4
keys = [m["Regex Pattern"]["Name"] for m in res]
===========changed ref 0===========
# module: tests.test_regex_identifier
def test_unix_timestamp3():
+ res = r.check(["1234567"], dist=d) # 7 numbers
- res = r.check(["1234567"]) # 7 numbers
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Timestamp" not in keys
assert "Recent Unix Timestamp" not in keys
===========changed ref 1===========
# module: tests.test_regex_identifier
def test_unix_timestamp4():
+ res = r.check(["1577836800000"], dist=d) # 2020-01-01
- res = r.check(["1577836800000"]) # 2020-01-01
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Millisecond Timestamp" in keys
assert "Recent Unix Millisecond Timestamp" in keys
===========changed ref 2===========
# module: tests.test_regex_identifier
def test_unix_timestamp2():
+ res = r.check(["94694400"], dist=d) # 1973-01-01
- res = r.check(["94694400"]) # 1973-01-01
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Timestamp" in keys
assert "Recent Unix Timestamp" not in keys
===========changed ref 3===========
# module: tests.test_regex_identifier
def test_unix_timestamp():
+ res = r.check(["1577836800"], dist=d) # 2020-01-01
- res = r.check(["1577836800"]) # 2020-01-01
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Timestamp" in keys
assert "Recent Unix Timestamp" in keys
===========changed ref 4===========
# module: tests.test_regex_identifier
def test_youtube_id2():
+ res = r.check(["078-05-1120"], dist=d)
- res = r.check(["078-05-1120"])
assert "YouTube Video ID" not in res
===========changed ref 5===========
# module: tests.test_regex_identifier
def test_youtube_id():
+ res = r.check(["dQw4w9WgXcQ"], dist=d)
- res = r.check(["dQw4w9WgXcQ"])
_assert_match_first_item("YouTube Video ID", res)
===========changed ref 6===========
# module: tests.test_regex_identifier
database = load_regexes()
r = regex_identifier.RegexIdentifier()
+ filter1 = Filter({"MinRarity": 0.0})
+ d = Distribution(filter1)
+ r_rarity_0 = regex_identifier.RegexIdentifier()
===========changed ref 7===========
# module: tests.test_click
def test_file_fixture_objectid():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ObjectID", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_file_fixture_ulid():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ULID", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_file_fixture_turkish_tax_number():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish Tax Number", str(result.output))
===========changed ref 10===========
# module: tests.test_click
def test_file_fixture_turkish_car_plate():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish License Plate Number", str(result.output))
===========changed ref 11===========
# module: pywhat
+ __version__ = "4.3.1"
- __version__ = "4.3.0"
tags = AvailableTags().get_tags()
pywhat_tags = tags # left for backward compatibility purposes
_contents = ["Identifier", "Distribution", "tags", "pywhat_tags", "Keys", "Filter"]
__all__ = _contents
del AvailableTags, filter
|
tests.test_regex_identifier/test_turkish_tax_number
|
Modified
|
bee-san~pyWhat
|
8b2a4e777457ac9716d084d06e080a6beb4cd9c9
|
Set some regex to 0
|
<0>:<add> res = r.check(["1234567890"], dist=d)
<del> res = r.check(["1234567890"])
|
# module: tests.test_regex_identifier
def test_turkish_tax_number():
<0> res = r.check(["1234567890"])
<1> assert "Turkish Tax Number" in str(res)
<2>
|
===========unchanged ref 0===========
at: tests.test_regex_identifier.test_turkish_id_number2
res = r.check(["12345678900"])
===========changed ref 0===========
# module: tests.test_regex_identifier
def test_unix_timestamp5():
+ res = r.check(["94694400000"], dist=d) # 1973-01-01
- res = r.check(["94694400000"]) # 1973-01-01
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Millisecond Timestamp" in keys
assert "Recent Unix Millisecond Timestamp" not in keys
===========changed ref 1===========
# module: tests.test_regex_identifier
def test_unix_timestamp3():
+ res = r.check(["1234567"], dist=d) # 7 numbers
- res = r.check(["1234567"]) # 7 numbers
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Timestamp" not in keys
assert "Recent Unix Timestamp" not in keys
===========changed ref 2===========
# module: tests.test_regex_identifier
def test_unix_timestamp4():
+ res = r.check(["1577836800000"], dist=d) # 2020-01-01
- res = r.check(["1577836800000"]) # 2020-01-01
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Millisecond Timestamp" in keys
assert "Recent Unix Millisecond Timestamp" in keys
===========changed ref 3===========
# module: tests.test_regex_identifier
def test_unix_timestamp2():
+ res = r.check(["94694400"], dist=d) # 1973-01-01
- res = r.check(["94694400"]) # 1973-01-01
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Timestamp" in keys
assert "Recent Unix Timestamp" not in keys
===========changed ref 4===========
# module: tests.test_regex_identifier
def test_unix_timestamp():
+ res = r.check(["1577836800"], dist=d) # 2020-01-01
- res = r.check(["1577836800"]) # 2020-01-01
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Timestamp" in keys
assert "Recent Unix Timestamp" in keys
===========changed ref 5===========
# module: tests.test_regex_identifier
def test_youtube_id2():
+ res = r.check(["078-05-1120"], dist=d)
- res = r.check(["078-05-1120"])
assert "YouTube Video ID" not in res
===========changed ref 6===========
# module: tests.test_regex_identifier
def test_youtube_id():
+ res = r.check(["dQw4w9WgXcQ"], dist=d)
- res = r.check(["dQw4w9WgXcQ"])
_assert_match_first_item("YouTube Video ID", res)
===========changed ref 7===========
# module: tests.test_regex_identifier
database = load_regexes()
r = regex_identifier.RegexIdentifier()
+ filter1 = Filter({"MinRarity": 0.0})
+ d = Distribution(filter1)
+ r_rarity_0 = regex_identifier.RegexIdentifier()
===========changed ref 8===========
# module: tests.test_click
def test_file_fixture_objectid():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ObjectID", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_file_fixture_ulid():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ULID", str(result.output))
===========changed ref 10===========
# module: tests.test_click
def test_file_fixture_turkish_tax_number():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish Tax Number", str(result.output))
===========changed ref 11===========
# module: tests.test_click
def test_file_fixture_turkish_car_plate():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish License Plate Number", str(result.output))
===========changed ref 12===========
# module: pywhat
+ __version__ = "4.3.1"
- __version__ = "4.3.0"
tags = AvailableTags().get_tags()
pywhat_tags = tags # left for backward compatibility purposes
_contents = ["Identifier", "Distribution", "tags", "pywhat_tags", "Keys", "Filter"]
__all__ = _contents
del AvailableTags, filter
|
tests.test_regex_identifier/test_objectid
|
Modified
|
bee-san~pyWhat
|
8b2a4e777457ac9716d084d06e080a6beb4cd9c9
|
Set some regex to 0
|
<0>:<add> res = r_rarity_0.check(["5fc7c33a7ef88b139122a38a"], dist=d)
<del> res = r.check(["5fc7c33a7ef88b139122a38a"])
|
# module: tests.test_regex_identifier
def test_objectid():
<0> res = r.check(["5fc7c33a7ef88b139122a38a"])
<1> assert "ObjectID" in str(res)
<2>
|
===========unchanged ref 0===========
at: tests.test_regex_identifier.test_uuid
res = r.check(["b2ced6f5-2542-4f7d-b131-e3ada95d8b75"])
===========changed ref 0===========
# module: tests.test_regex_identifier
def test_turkish_tax_number():
+ res = r.check(["1234567890"], dist=d)
- res = r.check(["1234567890"])
assert "Turkish Tax Number" in str(res)
===========changed ref 1===========
# module: tests.test_regex_identifier
def test_unix_timestamp5():
+ res = r.check(["94694400000"], dist=d) # 1973-01-01
- res = r.check(["94694400000"]) # 1973-01-01
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Millisecond Timestamp" in keys
assert "Recent Unix Millisecond Timestamp" not in keys
===========changed ref 2===========
# module: tests.test_regex_identifier
def test_unix_timestamp3():
+ res = r.check(["1234567"], dist=d) # 7 numbers
- res = r.check(["1234567"]) # 7 numbers
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Timestamp" not in keys
assert "Recent Unix Timestamp" not in keys
===========changed ref 3===========
# module: tests.test_regex_identifier
def test_unix_timestamp4():
+ res = r.check(["1577836800000"], dist=d) # 2020-01-01
- res = r.check(["1577836800000"]) # 2020-01-01
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Millisecond Timestamp" in keys
assert "Recent Unix Millisecond Timestamp" in keys
===========changed ref 4===========
# module: tests.test_regex_identifier
def test_unix_timestamp2():
+ res = r.check(["94694400"], dist=d) # 1973-01-01
- res = r.check(["94694400"]) # 1973-01-01
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Timestamp" in keys
assert "Recent Unix Timestamp" not in keys
===========changed ref 5===========
# module: tests.test_regex_identifier
def test_unix_timestamp():
+ res = r.check(["1577836800"], dist=d) # 2020-01-01
- res = r.check(["1577836800"]) # 2020-01-01
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Timestamp" in keys
assert "Recent Unix Timestamp" in keys
===========changed ref 6===========
# module: tests.test_regex_identifier
def test_youtube_id2():
+ res = r.check(["078-05-1120"], dist=d)
- res = r.check(["078-05-1120"])
assert "YouTube Video ID" not in res
===========changed ref 7===========
# module: tests.test_regex_identifier
def test_youtube_id():
+ res = r.check(["dQw4w9WgXcQ"], dist=d)
- res = r.check(["dQw4w9WgXcQ"])
_assert_match_first_item("YouTube Video ID", res)
===========changed ref 8===========
# module: tests.test_regex_identifier
database = load_regexes()
r = regex_identifier.RegexIdentifier()
+ filter1 = Filter({"MinRarity": 0.0})
+ d = Distribution(filter1)
+ r_rarity_0 = regex_identifier.RegexIdentifier()
===========changed ref 9===========
# module: tests.test_click
def test_file_fixture_objectid():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ObjectID", str(result.output))
===========changed ref 10===========
# module: tests.test_click
def test_file_fixture_ulid():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ULID", str(result.output))
===========changed ref 11===========
# module: tests.test_click
def test_file_fixture_turkish_tax_number():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish Tax Number", str(result.output))
===========changed ref 12===========
# module: tests.test_click
def test_file_fixture_turkish_car_plate():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish License Plate Number", str(result.output))
===========changed ref 13===========
# module: pywhat
+ __version__ = "4.3.1"
- __version__ = "4.3.0"
tags = AvailableTags().get_tags()
pywhat_tags = tags # left for backward compatibility purposes
_contents = ["Identifier", "Distribution", "tags", "pywhat_tags", "Keys", "Filter"]
__all__ = _contents
del AvailableTags, filter
|
tests.test_regex_identifier/test_ulid
|
Modified
|
bee-san~pyWhat
|
8b2a4e777457ac9716d084d06e080a6beb4cd9c9
|
Set some regex to 0
|
<0>:<add> res = r_rarity_0.check(["01ERJ58HMWDN3VTRRHZQV2T5R5"], dist=d)
<del> res = r.check(["01ERJ58HMWDN3VTRRHZQV2T5R5"])
|
# module: tests.test_regex_identifier
def test_ulid():
<0> res = r.check(["01ERJ58HMWDN3VTRRHZQV2T5R5"])
<1> assert "ULID" in str(res)
<2>
|
===========unchanged ref 0===========
at: tests.test_regex_identifier.test_objectid
res = r_rarity_0.check(["5fc7c33a7ef88b139122a38a"], dist=d)
===========changed ref 0===========
# module: tests.test_regex_identifier
def test_turkish_tax_number():
+ res = r.check(["1234567890"], dist=d)
- res = r.check(["1234567890"])
assert "Turkish Tax Number" in str(res)
===========changed ref 1===========
# module: tests.test_regex_identifier
def test_objectid():
+ res = r_rarity_0.check(["5fc7c33a7ef88b139122a38a"], dist=d)
- res = r.check(["5fc7c33a7ef88b139122a38a"])
assert "ObjectID" in str(res)
===========changed ref 2===========
# module: tests.test_regex_identifier
def test_unix_timestamp5():
+ res = r.check(["94694400000"], dist=d) # 1973-01-01
- res = r.check(["94694400000"]) # 1973-01-01
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Millisecond Timestamp" in keys
assert "Recent Unix Millisecond Timestamp" not in keys
===========changed ref 3===========
# module: tests.test_regex_identifier
def test_unix_timestamp3():
+ res = r.check(["1234567"], dist=d) # 7 numbers
- res = r.check(["1234567"]) # 7 numbers
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Timestamp" not in keys
assert "Recent Unix Timestamp" not in keys
===========changed ref 4===========
# module: tests.test_regex_identifier
def test_unix_timestamp4():
+ res = r.check(["1577836800000"], dist=d) # 2020-01-01
- res = r.check(["1577836800000"]) # 2020-01-01
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Millisecond Timestamp" in keys
assert "Recent Unix Millisecond Timestamp" in keys
===========changed ref 5===========
# module: tests.test_regex_identifier
def test_unix_timestamp2():
+ res = r.check(["94694400"], dist=d) # 1973-01-01
- res = r.check(["94694400"]) # 1973-01-01
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Timestamp" in keys
assert "Recent Unix Timestamp" not in keys
===========changed ref 6===========
# module: tests.test_regex_identifier
def test_unix_timestamp():
+ res = r.check(["1577836800"], dist=d) # 2020-01-01
- res = r.check(["1577836800"]) # 2020-01-01
keys = [m["Regex Pattern"]["Name"] for m in res]
assert "Unix Timestamp" in keys
assert "Recent Unix Timestamp" in keys
===========changed ref 7===========
# module: tests.test_regex_identifier
def test_youtube_id2():
+ res = r.check(["078-05-1120"], dist=d)
- res = r.check(["078-05-1120"])
assert "YouTube Video ID" not in res
===========changed ref 8===========
# module: tests.test_regex_identifier
def test_youtube_id():
+ res = r.check(["dQw4w9WgXcQ"], dist=d)
- res = r.check(["dQw4w9WgXcQ"])
_assert_match_first_item("YouTube Video ID", res)
===========changed ref 9===========
# module: tests.test_regex_identifier
database = load_regexes()
r = regex_identifier.RegexIdentifier()
+ filter1 = Filter({"MinRarity": 0.0})
+ d = Distribution(filter1)
+ r_rarity_0 = regex_identifier.RegexIdentifier()
===========changed ref 10===========
# module: tests.test_click
def test_file_fixture_objectid():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ObjectID", str(result.output))
===========changed ref 11===========
# module: tests.test_click
def test_file_fixture_ulid():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("ULID", str(result.output))
===========changed ref 12===========
# module: tests.test_click
def test_file_fixture_turkish_tax_number():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish Tax Number", str(result.output))
===========changed ref 13===========
# module: tests.test_click
def test_file_fixture_turkish_car_plate():
runner = CliRunner()
+ result = runner.invoke(main, ["--rarity", "0:", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish License Plate Number", str(result.output))
===========changed ref 14===========
# module: pywhat
+ __version__ = "4.3.1"
- __version__ = "4.3.0"
tags = AvailableTags().get_tags()
pywhat_tags = tags # left for backward compatibility purposes
_contents = ["Identifier", "Distribution", "tags", "pywhat_tags", "Keys", "Filter"]
__all__ = _contents
del AvailableTags, filter
|
tests.test_click/test_file_fixture_sshpass
|
Modified
|
bee-san~pyWhat
|
e42d52d9fc8df1a0ffba0aff747b6d543ded1383
|
Fix SSHPass tests
|
<3>:<add> assert re.findall("SSHPass Clear Password Argument", str(result.output))
<del> assert re.findall("SSHPass clear password argument", str(result.output))
|
# module: tests.test_click
def test_file_fixture_sshpass():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["fixtures/file"])
<2> assert result.exit_code == 0
<3> assert re.findall("SSHPass clear password argument", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: click.testing.Result.__init__
self.exit_code = exit_code
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
|
tests.test_regex_identifier/test_sshpass
|
Modified
|
bee-san~pyWhat
|
e42d52d9fc8df1a0ffba0aff747b6d543ded1383
|
Fix SSHPass tests
|
<1>:<add> _assert_match_first_item("SSHPass Clear Password Argument", res)
<del> _assert_match_first_item("SSHPass clear password argument", res)
|
# module: tests.test_regex_identifier
def test_sshpass():
<0> res = r.check(["sshpass -p MyPassw0RD!"])
<1> _assert_match_first_item("SSHPass clear password argument", res)
<2>
|
===========unchanged ref 0===========
at: pywhat.regex_identifier.RegexIdentifier
check(text, dist: Optional[Distribution]=None, *, boundaryless: Optional[Filter]=None)
at: tests.test_regex_identifier
r = regex_identifier.RegexIdentifier()
_assert_match_first_item(name, res)
===========changed ref 0===========
# module: tests.test_click
def test_file_fixture_sshpass():
runner = CliRunner()
result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
+ assert re.findall("SSHPass Clear Password Argument", str(result.output))
- assert re.findall("SSHPass clear password argument", str(result.output))
|
tests.test_regex_identifier/test_sshpass_multiple_args
|
Modified
|
bee-san~pyWhat
|
e42d52d9fc8df1a0ffba0aff747b6d543ded1383
|
Fix SSHPass tests
|
<1>:<add> _assert_match_first_item("SSHPass Clear Password Argument", res)
<del> _assert_match_first_item("SSHPass clear password argument", res)
|
# module: tests.test_regex_identifier
def test_sshpass_multiple_args():
<0> res = r.check(["sshpass -P 'Please enter your password' -p MyPassw0RD!"])
<1> _assert_match_first_item("SSHPass clear password argument", res)
<2>
|
===========unchanged ref 0===========
at: pywhat.regex_identifier.RegexIdentifier
check(text, dist: Optional[Distribution]=None, *, boundaryless: Optional[Filter]=None)
at: tests.test_regex_identifier
r = regex_identifier.RegexIdentifier()
_assert_match_first_item(name, res)
===========changed ref 0===========
# module: tests.test_regex_identifier
def test_sshpass():
res = r.check(["sshpass -p MyPassw0RD!"])
+ _assert_match_first_item("SSHPass Clear Password Argument", res)
- _assert_match_first_item("SSHPass clear password argument", res)
===========changed ref 1===========
# module: tests.test_click
def test_file_fixture_sshpass():
runner = CliRunner()
result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
+ assert re.findall("SSHPass Clear Password Argument", str(result.output))
- assert re.findall("SSHPass clear password argument", str(result.output))
|
tests.test_regex_identifier/test_aws_ec2_id
|
Modified
|
bee-san~pyWhat
|
388200a48149482e565ab3c7a8ed01580d09be55
|
Fix changed regex tests
|
<1>:<add> assert "Amazon Web Services EC2 Instance Identifier" in str(res)
<del> assert "Amazon Web Services EC2 Instance identifier" in str(res)
|
# module: tests.test_regex_identifier
def test_aws_ec2_id():
<0> res = r.check(["i-1234567890abcdef0"])
<1> assert "Amazon Web Services EC2 Instance identifier" in str(res)
<2>
|
===========unchanged ref 0===========
at: pywhat.regex_identifier.RegexIdentifier
check(text, dist: Optional[Distribution]=None, *, boundaryless: Optional[Filter]=None)
at: tests.test_regex_identifier
r = regex_identifier.RegexIdentifier()
|
tests.test_regex_identifier/test_aws_org_id
|
Modified
|
bee-san~pyWhat
|
388200a48149482e565ab3c7a8ed01580d09be55
|
Fix changed regex tests
|
<1>:<add> assert "Amazon Web Services Organization Identifier" in str(res)
<del> assert "Amazon Web Services Organization identifier" in str(res)
|
# module: tests.test_regex_identifier
def test_aws_org_id():
<0> res = r.check(["o-aa111bb222"])
<1> assert "Amazon Web Services Organization identifier" in str(res)
<2>
|
===========unchanged ref 0===========
at: pywhat.regex_identifier.RegexIdentifier
check(text, dist: Optional[Distribution]=None, *, boundaryless: Optional[Filter]=None)
at: tests.test_regex_identifier
r = regex_identifier.RegexIdentifier()
===========changed ref 0===========
# module: tests.test_regex_identifier
def test_aws_ec2_id():
res = r.check(["i-1234567890abcdef0"])
+ assert "Amazon Web Services EC2 Instance Identifier" in str(res)
- assert "Amazon Web Services EC2 Instance identifier" in str(res)
|
tests.test_identifier/test_name_capitalization
|
Modified
|
bee-san~pyWhat
|
59f18027214d2116da629a1bdd7487fa94e54216
|
Accept any name containing a num or an upper case char
|
<6>:<add> if upper_and_num_count > 0:
<del> if upper_and_num_count > 1:
|
# module: tests.test_identifier
def test_name_capitalization():
<0> database = load_regexes()
<1>
<2> for entry in database:
<3> entry_name = entry["Name"]
<4> for word in entry_name.split(" "):
<5> upper_and_num_count = sum(1 for c in word if c.isupper() or c.isnumeric())
<6> if upper_and_num_count > 1:
<7> continue
<8> cleaned_word = word.translate({ord(c): None for c in "(),."})
<9> if cleaned_word in ["a", "of", "etc"]:
<10> continue
<11>
<12> assert word.title() == word
<13>
|
===========unchanged ref 0===========
at: pywhat.helper
_lru_cache_wrapper(*args: Hashable, **kwargs: Hashable) -> _T
|
pywhat.what/main
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<s>-filenames",
is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
<0> """
<1> pyWhat - Identify what something is.
<2>
<3> Made by Bee https://twitter.com/bee_sec_san
<4>
<5> https://github.com/bee-san
<6>
<7> Filtration:
<8>
<9> --rarity min:max
<10>
<11> Rarity is how unlikely something is to be a false-positive. The higher the number, the more unlikely.
<12>
<13> Only print entries with rarity in range [min,max]. min and max can be omitted.
<14>
<15> Note: PyWhat by default has a rarity of 0.1. To see all matches, with many potential false positives use `0:`.
<16>
<17> --include list
<18>
<19> Only include entries containing at least one tag in a list. List is a comma separated list.
<20>
<21> --exclude list
<22>
<23> Exclude specified tags. List is a comma separated list.
<24>
<25> Sorting:
<26>
<27> --key key_name
<28>
<29> Sort by the given key.
<30>
<31> --reverse
<32>
<33> Sort in reverse order.
<34>
<35> Available keys:
<36>
<37> name - Sort by the name of regex pattern
<38>
<39> rarity - Sort by rarity
<40>
<41> matched - Sort by a matched string
<42>
<43> none - No sorting is done (the default)
<44>
<45> Exporting:
<46>
</s>
|
===========below chunk 0===========
<s> is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
# offset: 1
Return results in json format.
Boundaryless mode:
CLI tool matches strings like 'abcdTHM{hello}plze' by default because the boundaryless mode is enabled for regexes with a rarity of 0.1 and higher.
Since boundaryless mode may produce a lot of false-positive matches, it is possible to disable it, either fully or partially.
'--disable-boundaryless' flag can be used to fully disable this mode.
In addition, '-br', '-bi', and '-be' options can be used to tweak which regexes should be in boundaryless mode.
Refer to the Filtration section for more information.
Examples:
* what 'HTB{this is a flag}'
* what '0x52908400098527886E0F7030069857D2E4169EE7'
* what -- '52.6169586, -1.9779857'
* what --rarity 0.6: '[email protected]'
* what --rarity 0: --include "credentials, username, password" --exclude "aws, credentials" 'James:SecretPassword'
* what -br 0.6: -be URL '[email protected]'
Your text must either be in quotation marks, or use the POSIX standard of "--" to mean "anything after -- is textual input".
pyWhat can also search files or</s>
===========below chunk 1===========
<s> is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
# offset: 2
<s> POSIX standard of "--" to mean "anything after -- is textual input".
pyWhat can also search files or even a whole directory with recursion:
* what 'secret.txt'
* what 'this/is/a/path'
"""
if kwargs["text_input"] is None:
sys.exit("Text input expected. Run 'pywhat --help' for help")
dist = Distribution(
create_filter(kwargs["rarity"], kwargs["include"], kwargs["exclude"])
)
if kwargs["disable_boundaryless"]:
boundaryless = Filter({"Tags": []}) # use empty filter
else:
boundaryless = create_filter(
kwargs["boundaryless_rarity"],
kwargs["boundaryless_include"],
kwargs["boundaryless_exclude"],
)
what_obj = What_Object(dist)
if kwargs["key"] is None:
key = Keys.NONE
else:
try:
key = str_to_key(kwargs["key"])
except ValueError:
print("Invalid key")
sys.exit(1)
identified_output = what_obj.what_is_this(
kwargs["text_input"],
kwargs["only_text"],
key,
kwargs["</s>
===========below chunk 2===========
<s> is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
# offset: 3
<s>],
boundaryless,
kwargs["include_filenames"],
)
p = printer.Printing()
if kwargs["json"] or kwargs["format"] == "json":
p.print_json(identified_output)
elif kwargs["format"] == "pretty":
p.pretty_print(identified_output, kwargs["text_input"])
else:
p.print_raw(identified_output, kwargs["text_input"])
===========unchanged ref 0===========
at: click.decorators
command(name: Optional[str]=..., cls: Optional[Type[Command]]=..., context_settings: Optional[Dict[Any, Any]]=..., help: Optional[str]=..., epilog: Optional[str]=..., short_help: Optional[str]=..., options_metavar: str=..., add_help_option: bool=..., hidden: bool=..., deprecated: bool=...) -> Callable[[Callable[..., Any]], Command]
argument(*param_decls: Text, cls: Type[Argument]=..., required: Optional[bool]=..., type: Optional[_ConvertibleType]=..., default: Optional[Any]=..., callback: Optional[_Callback]=..., nargs: Optional[int]=..., metavar: Optional[str]=..., expose_value: bool=..., is_eager: bool=..., envvar: Optional[Union[str, List[str]]]=..., autocompletion: Optional[Callable[[Any, List[str], str], List[Union[str, Tuple[str, str]]]]]=...) -> _IdentityFunction
|
|
tests.test_click/test_nothing_found
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<1>:<add> result = runner.invoke(main, ["-db", ""])
<del> result = runner.invoke(main, [""])
|
# module: tests.test_click
def test_nothing_found():
<0> runner = CliRunner()
<1> result = runner.invoke(main, [""])
<2> assert result.exit_code == 0
<3> assert "Nothing found!" in result.output
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: click.testing.Result.__init__
self.exit_code = exit_code
at: pywhat.what
main(**kwargs)
===========changed ref 0===========
<s>-filenames",
is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
"""
pyWhat - Identify what something is.
Made by Bee https://twitter.com/bee_sec_san
https://github.com/bee-san
Filtration:
--rarity min:max
Rarity is how unlikely something is to be a false-positive. The higher the number, the more unlikely.
Only print entries with rarity in range [min,max]. min and max can be omitted.
Note: PyWhat by default has a rarity of 0.1. To see all matches, with many potential false positives use `0:`.
--include list
Only include entries containing at least one tag in a list. List is a comma separated list.
--exclude list
Exclude specified tags. List is a comma separated list.
Sorting:
--key key_name
Sort by the given key.
--reverse
Sort in reverse order.
Available keys:
name - Sort by the name of regex pattern
rarity - Sort by rarity
matched - Sort by a matched string
none - No sorting is done (the default)
Exporting:
--json
Return results in json format.
Boundaryless mode:
CLI tool matches strings like 'abcdTHM{hello}plze' by default because</s>
===========changed ref 1===========
<s> is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
# offset: 1
<s>
Boundaryless mode:
CLI tool matches strings like 'abcdTHM{hello}plze' by default because the boundaryless mode is enabled for regexes with a rarity of 0.1 and higher.
Since boundaryless mode may produce a lot of false-positive matches, it is possible to disable it, either fully or partially.
'--disable-boundaryless' flag can be used to fully disable this mode.
In addition, '-br', '-bi', and '-be' options can be used to tweak which regexes should be in boundaryless mode.
Refer to the Filtration section for more information.
+ Formatting the output:
+
+ --format format_str
+
+ format_str can be equal to:
+
+ pretty - Output data in the table
+
+ json - Ouput data in json format
+
+ CUSTOM_STRING - Print data in the way you want. For every match CUSTOM_STRING will be printed and '%x' (See below for possible x values) will be substituted with a match value.
+
+ For example:
+
+ pywhat --format '%m - %n' 'google.com htb{flag}'
+
+ will print:
+
+ htb{flag} - HackTheBox Flag Format
+ google.com - Uniform Resource Locator (URL)</s>
===========changed ref 2===========
<s> is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
# offset: 2
<s> <add>
+ Possible '%x' values:
+
+ %m - matched text
+
+ %n - name of regex
+
+ %d - description (will not output if absent)
+
+ %e - exploit (will not ouput if absent)
+
+ %r - rarity
+
+ %l - link (will not ouput if absent)
+
+ %t - tags (in 'tag1, tag2 ...' format)
+
+ If you want to print '%' or '\' character - escape it: '\%', '\\'.
Examples:
* what 'HTB{this is a flag}'
* what '0x52908400098527886E0F7030069857D2E4169EE7'
* what -- '52.6169586, -1.9779857'
* what --rarity 0.6: '[email protected]'
* what --rarity 0: --include "credentials, username, password" --exclude "aws, credentials" 'James:SecretPassword'
* what -br 0.6: -be URL '[email protected]'
Your text must either be in quotation marks, or use the POSIX standard of "--" to mean "any</s>
|
tests.test_click/test_hello_world
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<1>:<add> result = runner.invoke(main, ["-db", "THM{this is a flag}"])
<del> result = runner.invoke(main, ["THM{this is a flag}"])
|
# module: tests.test_click
def test_hello_world():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["THM{this is a flag}"])
<2> assert result.exit_code == 0
<3> assert "THM{" in result.output
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: click.testing.Result.__init__
self.exit_code = exit_code
at: pywhat.what
main(**kwargs)
===========changed ref 0===========
# module: tests.test_click
def test_nothing_found():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", ""])
- result = runner.invoke(main, [""])
assert result.exit_code == 0
assert "Nothing found!" in result.output
===========changed ref 1===========
<s>-filenames",
is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
"""
pyWhat - Identify what something is.
Made by Bee https://twitter.com/bee_sec_san
https://github.com/bee-san
Filtration:
--rarity min:max
Rarity is how unlikely something is to be a false-positive. The higher the number, the more unlikely.
Only print entries with rarity in range [min,max]. min and max can be omitted.
Note: PyWhat by default has a rarity of 0.1. To see all matches, with many potential false positives use `0:`.
--include list
Only include entries containing at least one tag in a list. List is a comma separated list.
--exclude list
Exclude specified tags. List is a comma separated list.
Sorting:
--key key_name
Sort by the given key.
--reverse
Sort in reverse order.
Available keys:
name - Sort by the name of regex pattern
rarity - Sort by rarity
matched - Sort by a matched string
none - No sorting is done (the default)
Exporting:
--json
Return results in json format.
Boundaryless mode:
CLI tool matches strings like 'abcdTHM{hello}plze' by default because</s>
===========changed ref 2===========
<s> is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
# offset: 1
<s>
Boundaryless mode:
CLI tool matches strings like 'abcdTHM{hello}plze' by default because the boundaryless mode is enabled for regexes with a rarity of 0.1 and higher.
Since boundaryless mode may produce a lot of false-positive matches, it is possible to disable it, either fully or partially.
'--disable-boundaryless' flag can be used to fully disable this mode.
In addition, '-br', '-bi', and '-be' options can be used to tweak which regexes should be in boundaryless mode.
Refer to the Filtration section for more information.
+ Formatting the output:
+
+ --format format_str
+
+ format_str can be equal to:
+
+ pretty - Output data in the table
+
+ json - Ouput data in json format
+
+ CUSTOM_STRING - Print data in the way you want. For every match CUSTOM_STRING will be printed and '%x' (See below for possible x values) will be substituted with a match value.
+
+ For example:
+
+ pywhat --format '%m - %n' 'google.com htb{flag}'
+
+ will print:
+
+ htb{flag} - HackTheBox Flag Format
+ google.com - Uniform Resource Locator (URL)</s>
===========changed ref 3===========
<s> is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
# offset: 2
<s> <add>
+ Possible '%x' values:
+
+ %m - matched text
+
+ %n - name of regex
+
+ %d - description (will not output if absent)
+
+ %e - exploit (will not ouput if absent)
+
+ %r - rarity
+
+ %l - link (will not ouput if absent)
+
+ %t - tags (in 'tag1, tag2 ...' format)
+
+ If you want to print '%' or '\' character - escape it: '\%', '\\'.
Examples:
* what 'HTB{this is a flag}'
* what '0x52908400098527886E0F7030069857D2E4169EE7'
* what -- '52.6169586, -1.9779857'
* what --rarity 0.6: '[email protected]'
* what --rarity 0: --include "credentials, username, password" --exclude "aws, credentials" 'James:SecretPassword'
* what -br 0.6: -be URL '[email protected]'
Your text must either be in quotation marks, or use the POSIX standard of "--" to mean "any</s>
|
tests.test_click/test_json_printing
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<2>:<add> result = runner.invoke(main, ["-db", "10.0.0.1", "--json"])
<del> result = runner.invoke(main, ["10.0.0.1", "--json"])
|
# module: tests.test_click
def test_json_printing():
<0> """Test for valid json"""
<1> runner = CliRunner()
<2> result = runner.invoke(main, ["10.0.0.1", "--json"])
<3> assert json.loads(result.output.replace("\n", ""))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: json
loads(s: Union[str, bytes], *, cls: Optional[Type[JSONDecoder]]=..., object_hook: Optional[Callable[[Dict[Any, Any]], Any]]=..., parse_float: Optional[Callable[[str], Any]]=..., parse_int: Optional[Callable[[str], Any]]=..., parse_constant: Optional[Callable[[str], Any]]=..., object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]]=..., **kwds: Any) -> Any
at: pywhat.what
main(**kwargs)
===========changed ref 0===========
# module: tests.test_click
def test_nothing_found():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", ""])
- result = runner.invoke(main, [""])
assert result.exit_code == 0
assert "Nothing found!" in result.output
===========changed ref 1===========
# module: tests.test_click
def test_hello_world():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "THM{this is a flag}"])
- result = runner.invoke(main, ["THM{this is a flag}"])
assert result.exit_code == 0
assert "THM{" in result.output
===========changed ref 2===========
<s>-filenames",
is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
"""
pyWhat - Identify what something is.
Made by Bee https://twitter.com/bee_sec_san
https://github.com/bee-san
Filtration:
--rarity min:max
Rarity is how unlikely something is to be a false-positive. The higher the number, the more unlikely.
Only print entries with rarity in range [min,max]. min and max can be omitted.
Note: PyWhat by default has a rarity of 0.1. To see all matches, with many potential false positives use `0:`.
--include list
Only include entries containing at least one tag in a list. List is a comma separated list.
--exclude list
Exclude specified tags. List is a comma separated list.
Sorting:
--key key_name
Sort by the given key.
--reverse
Sort in reverse order.
Available keys:
name - Sort by the name of regex pattern
rarity - Sort by rarity
matched - Sort by a matched string
none - No sorting is done (the default)
Exporting:
--json
Return results in json format.
Boundaryless mode:
CLI tool matches strings like 'abcdTHM{hello}plze' by default because</s>
===========changed ref 3===========
<s> is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
# offset: 1
<s>
Boundaryless mode:
CLI tool matches strings like 'abcdTHM{hello}plze' by default because the boundaryless mode is enabled for regexes with a rarity of 0.1 and higher.
Since boundaryless mode may produce a lot of false-positive matches, it is possible to disable it, either fully or partially.
'--disable-boundaryless' flag can be used to fully disable this mode.
In addition, '-br', '-bi', and '-be' options can be used to tweak which regexes should be in boundaryless mode.
Refer to the Filtration section for more information.
+ Formatting the output:
+
+ --format format_str
+
+ format_str can be equal to:
+
+ pretty - Output data in the table
+
+ json - Ouput data in json format
+
+ CUSTOM_STRING - Print data in the way you want. For every match CUSTOM_STRING will be printed and '%x' (See below for possible x values) will be substituted with a match value.
+
+ For example:
+
+ pywhat --format '%m - %n' 'google.com htb{flag}'
+
+ will print:
+
+ htb{flag} - HackTheBox Flag Format
+ google.com - Uniform Resource Locator (URL)</s>
===========changed ref 4===========
<s> is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
# offset: 2
<s> <add>
+ Possible '%x' values:
+
+ %m - matched text
+
+ %n - name of regex
+
+ %d - description (will not output if absent)
+
+ %e - exploit (will not ouput if absent)
+
+ %r - rarity
+
+ %l - link (will not ouput if absent)
+
+ %t - tags (in 'tag1, tag2 ...' format)
+
+ If you want to print '%' or '\' character - escape it: '\%', '\\'.
Examples:
* what 'HTB{this is a flag}'
* what '0x52908400098527886E0F7030069857D2E4169EE7'
* what -- '52.6169586, -1.9779857'
* what --rarity 0.6: '[email protected]'
* what --rarity 0: --include "credentials, username, password" --exclude "aws, credentials" 'James:SecretPassword'
* what -br 0.6: -be URL '[email protected]'
Your text must either be in quotation marks, or use the POSIX standard of "--" to mean "any</s>
|
tests.test_click/test_json_printing2
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<2>:<add> result = runner.invoke(main, ["-db", "", "--json"])
<del> result = runner.invoke(main, ["", "--json"])
|
# module: tests.test_click
def test_json_printing2():
<0> """Test for empty json return"""
<1> runner = CliRunner()
<2> result = runner.invoke(main, ["", "--json"])
<3> assert result.output.strip("\n") == '{"File Signatures": null, "Regexes": null}'
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
===========changed ref 0===========
# module: tests.test_click
def test_json_printing():
"""Test for valid json"""
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "10.0.0.1", "--json"])
- result = runner.invoke(main, ["10.0.0.1", "--json"])
assert json.loads(result.output.replace("\n", ""))
===========changed ref 1===========
# module: tests.test_click
def test_nothing_found():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", ""])
- result = runner.invoke(main, [""])
assert result.exit_code == 0
assert "Nothing found!" in result.output
===========changed ref 2===========
# module: tests.test_click
def test_hello_world():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "THM{this is a flag}"])
- result = runner.invoke(main, ["THM{this is a flag}"])
assert result.exit_code == 0
assert "THM{" in result.output
===========changed ref 3===========
<s>-filenames",
is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
"""
pyWhat - Identify what something is.
Made by Bee https://twitter.com/bee_sec_san
https://github.com/bee-san
Filtration:
--rarity min:max
Rarity is how unlikely something is to be a false-positive. The higher the number, the more unlikely.
Only print entries with rarity in range [min,max]. min and max can be omitted.
Note: PyWhat by default has a rarity of 0.1. To see all matches, with many potential false positives use `0:`.
--include list
Only include entries containing at least one tag in a list. List is a comma separated list.
--exclude list
Exclude specified tags. List is a comma separated list.
Sorting:
--key key_name
Sort by the given key.
--reverse
Sort in reverse order.
Available keys:
name - Sort by the name of regex pattern
rarity - Sort by rarity
matched - Sort by a matched string
none - No sorting is done (the default)
Exporting:
--json
Return results in json format.
Boundaryless mode:
CLI tool matches strings like 'abcdTHM{hello}plze' by default because</s>
===========changed ref 4===========
<s> is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
# offset: 1
<s>
Boundaryless mode:
CLI tool matches strings like 'abcdTHM{hello}plze' by default because the boundaryless mode is enabled for regexes with a rarity of 0.1 and higher.
Since boundaryless mode may produce a lot of false-positive matches, it is possible to disable it, either fully or partially.
'--disable-boundaryless' flag can be used to fully disable this mode.
In addition, '-br', '-bi', and '-be' options can be used to tweak which regexes should be in boundaryless mode.
Refer to the Filtration section for more information.
+ Formatting the output:
+
+ --format format_str
+
+ format_str can be equal to:
+
+ pretty - Output data in the table
+
+ json - Ouput data in json format
+
+ CUSTOM_STRING - Print data in the way you want. For every match CUSTOM_STRING will be printed and '%x' (See below for possible x values) will be substituted with a match value.
+
+ For example:
+
+ pywhat --format '%m - %n' 'google.com htb{flag}'
+
+ will print:
+
+ htb{flag} - HackTheBox Flag Format
+ google.com - Uniform Resource Locator (URL)</s>
===========changed ref 5===========
<s> is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
# offset: 2
<s> <add>
+ Possible '%x' values:
+
+ %m - matched text
+
+ %n - name of regex
+
+ %d - description (will not output if absent)
+
+ %e - exploit (will not ouput if absent)
+
+ %r - rarity
+
+ %l - link (will not ouput if absent)
+
+ %t - tags (in 'tag1, tag2 ...' format)
+
+ If you want to print '%' or '\' character - escape it: '\%', '\\'.
Examples:
* what 'HTB{this is a flag}'
* what '0x52908400098527886E0F7030069857D2E4169EE7'
* what -- '52.6169586, -1.9779857'
* what --rarity 0.6: '[email protected]'
* what --rarity 0: --include "credentials, username, password" --exclude "aws, credentials" 'James:SecretPassword'
* what -br 0.6: -be URL '[email protected]'
Your text must either be in quotation marks, or use the POSIX standard of "--" to mean "any</s>
|
tests.test_click/test_arg_parsing
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<1>:<add> result = runner.invoke(main, ["-db", "1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
<del> result = runner.invoke(main, ["1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
|
# module: tests.test_click
def test_arg_parsing():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
<2> assert result.exit_code == 0
<3> assert re.findall("blockchain", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: click.testing.Result.__init__
self.exit_code = exit_code
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
===========changed ref 0===========
# module: tests.test_click
def test_json_printing2():
"""Test for empty json return"""
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "", "--json"])
- result = runner.invoke(main, ["", "--json"])
assert result.output.strip("\n") == '{"File Signatures": null, "Regexes": null}'
===========changed ref 1===========
# module: tests.test_click
def test_json_printing():
"""Test for valid json"""
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "10.0.0.1", "--json"])
- result = runner.invoke(main, ["10.0.0.1", "--json"])
assert json.loads(result.output.replace("\n", ""))
===========changed ref 2===========
# module: tests.test_click
def test_nothing_found():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", ""])
- result = runner.invoke(main, [""])
assert result.exit_code == 0
assert "Nothing found!" in result.output
===========changed ref 3===========
# module: tests.test_click
def test_hello_world():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "THM{this is a flag}"])
- result = runner.invoke(main, ["THM{this is a flag}"])
assert result.exit_code == 0
assert "THM{" in result.output
===========changed ref 4===========
<s>-filenames",
is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
"""
pyWhat - Identify what something is.
Made by Bee https://twitter.com/bee_sec_san
https://github.com/bee-san
Filtration:
--rarity min:max
Rarity is how unlikely something is to be a false-positive. The higher the number, the more unlikely.
Only print entries with rarity in range [min,max]. min and max can be omitted.
Note: PyWhat by default has a rarity of 0.1. To see all matches, with many potential false positives use `0:`.
--include list
Only include entries containing at least one tag in a list. List is a comma separated list.
--exclude list
Exclude specified tags. List is a comma separated list.
Sorting:
--key key_name
Sort by the given key.
--reverse
Sort in reverse order.
Available keys:
name - Sort by the name of regex pattern
rarity - Sort by rarity
matched - Sort by a matched string
none - No sorting is done (the default)
Exporting:
--json
Return results in json format.
Boundaryless mode:
CLI tool matches strings like 'abcdTHM{hello}plze' by default because</s>
===========changed ref 5===========
<s> is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
# offset: 1
<s>
Boundaryless mode:
CLI tool matches strings like 'abcdTHM{hello}plze' by default because the boundaryless mode is enabled for regexes with a rarity of 0.1 and higher.
Since boundaryless mode may produce a lot of false-positive matches, it is possible to disable it, either fully or partially.
'--disable-boundaryless' flag can be used to fully disable this mode.
In addition, '-br', '-bi', and '-be' options can be used to tweak which regexes should be in boundaryless mode.
Refer to the Filtration section for more information.
+ Formatting the output:
+
+ --format format_str
+
+ format_str can be equal to:
+
+ pretty - Output data in the table
+
+ json - Ouput data in json format
+
+ CUSTOM_STRING - Print data in the way you want. For every match CUSTOM_STRING will be printed and '%x' (See below for possible x values) will be substituted with a match value.
+
+ For example:
+
+ pywhat --format '%m - %n' 'google.com htb{flag}'
+
+ will print:
+
+ htb{flag} - HackTheBox Flag Format
+ google.com - Uniform Resource Locator (URL)</s>
|
tests.test_click/test_file_fixture_email2
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<1>:<add> result = runner.invoke(main, ["-db", "[email protected]"])
<del> result = runner.invoke(main, ["[email protected]"])
|
# module: tests.test_click
def test_file_fixture_email2():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["[email protected]"])
<2> assert result.exit_code == 0
<3> assert re.findall("Email", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: click.testing.Result.__init__
self.exit_code = exit_code
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
===========changed ref 0===========
# module: tests.test_click
def test_arg_parsing():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
- result = runner.invoke(main, ["1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_json_printing2():
"""Test for empty json return"""
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "", "--json"])
- result = runner.invoke(main, ["", "--json"])
assert result.output.strip("\n") == '{"File Signatures": null, "Regexes": null}'
===========changed ref 2===========
# module: tests.test_click
def test_json_printing():
"""Test for valid json"""
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "10.0.0.1", "--json"])
- result = runner.invoke(main, ["10.0.0.1", "--json"])
assert json.loads(result.output.replace("\n", ""))
===========changed ref 3===========
# module: tests.test_click
def test_nothing_found():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", ""])
- result = runner.invoke(main, [""])
assert result.exit_code == 0
assert "Nothing found!" in result.output
===========changed ref 4===========
# module: tests.test_click
def test_hello_world():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "THM{this is a flag}"])
- result = runner.invoke(main, ["THM{this is a flag}"])
assert result.exit_code == 0
assert "THM{" in result.output
===========changed ref 5===========
<s>-filenames",
is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
"""
pyWhat - Identify what something is.
Made by Bee https://twitter.com/bee_sec_san
https://github.com/bee-san
Filtration:
--rarity min:max
Rarity is how unlikely something is to be a false-positive. The higher the number, the more unlikely.
Only print entries with rarity in range [min,max]. min and max can be omitted.
Note: PyWhat by default has a rarity of 0.1. To see all matches, with many potential false positives use `0:`.
--include list
Only include entries containing at least one tag in a list. List is a comma separated list.
--exclude list
Exclude specified tags. List is a comma separated list.
Sorting:
--key key_name
Sort by the given key.
--reverse
Sort in reverse order.
Available keys:
name - Sort by the name of regex pattern
rarity - Sort by rarity
matched - Sort by a matched string
none - No sorting is done (the default)
Exporting:
--json
Return results in json format.
Boundaryless mode:
CLI tool matches strings like 'abcdTHM{hello}plze' by default because</s>
===========changed ref 6===========
<s> is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
# offset: 1
<s>
Boundaryless mode:
CLI tool matches strings like 'abcdTHM{hello}plze' by default because the boundaryless mode is enabled for regexes with a rarity of 0.1 and higher.
Since boundaryless mode may produce a lot of false-positive matches, it is possible to disable it, either fully or partially.
'--disable-boundaryless' flag can be used to fully disable this mode.
In addition, '-br', '-bi', and '-be' options can be used to tweak which regexes should be in boundaryless mode.
Refer to the Filtration section for more information.
+ Formatting the output:
+
+ --format format_str
+
+ format_str can be equal to:
+
+ pretty - Output data in the table
+
+ json - Ouput data in json format
+
+ CUSTOM_STRING - Print data in the way you want. For every match CUSTOM_STRING will be printed and '%x' (See below for possible x values) will be substituted with a match value.
+
+ For example:
+
+ pywhat --format '%m - %n' 'google.com htb{flag}'
+
+ will print:
+
+ htb{flag} - HackTheBox Flag Format
+ google.com - Uniform Resource Locator (URL)</s>
|
tests.test_click/test_file_fixture_ip4
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<1>:<add> result = runner.invoke(main, ["-db", "118.103.238.230"])
<del> result = runner.invoke(main, ["118.103.238.230"])
|
# module: tests.test_click
def test_file_fixture_ip4():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["118.103.238.230"])
<2> assert result.exit_code == 0
<3> assert re.findall("Address Version 4", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
===========changed ref 0===========
# module: tests.test_click
def test_file_fixture_email2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "[email protected]"])
- result = runner.invoke(main, ["[email protected]"])
assert result.exit_code == 0
assert re.findall("Email", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_arg_parsing():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
- result = runner.invoke(main, ["1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_json_printing2():
"""Test for empty json return"""
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "", "--json"])
- result = runner.invoke(main, ["", "--json"])
assert result.output.strip("\n") == '{"File Signatures": null, "Regexes": null}'
===========changed ref 3===========
# module: tests.test_click
def test_json_printing():
"""Test for valid json"""
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "10.0.0.1", "--json"])
- result = runner.invoke(main, ["10.0.0.1", "--json"])
assert json.loads(result.output.replace("\n", ""))
===========changed ref 4===========
# module: tests.test_click
def test_nothing_found():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", ""])
- result = runner.invoke(main, [""])
assert result.exit_code == 0
assert "Nothing found!" in result.output
===========changed ref 5===========
# module: tests.test_click
def test_hello_world():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "THM{this is a flag}"])
- result = runner.invoke(main, ["THM{this is a flag}"])
assert result.exit_code == 0
assert "THM{" in result.output
===========changed ref 6===========
<s>-filenames",
is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
"""
pyWhat - Identify what something is.
Made by Bee https://twitter.com/bee_sec_san
https://github.com/bee-san
Filtration:
--rarity min:max
Rarity is how unlikely something is to be a false-positive. The higher the number, the more unlikely.
Only print entries with rarity in range [min,max]. min and max can be omitted.
Note: PyWhat by default has a rarity of 0.1. To see all matches, with many potential false positives use `0:`.
--include list
Only include entries containing at least one tag in a list. List is a comma separated list.
--exclude list
Exclude specified tags. List is a comma separated list.
Sorting:
--key key_name
Sort by the given key.
--reverse
Sort in reverse order.
Available keys:
name - Sort by the name of regex pattern
rarity - Sort by rarity
matched - Sort by a matched string
none - No sorting is done (the default)
Exporting:
--json
Return results in json format.
Boundaryless mode:
CLI tool matches strings like 'abcdTHM{hello}plze' by default because</s>
===========changed ref 7===========
<s> is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
# offset: 1
<s>
Boundaryless mode:
CLI tool matches strings like 'abcdTHM{hello}plze' by default because the boundaryless mode is enabled for regexes with a rarity of 0.1 and higher.
Since boundaryless mode may produce a lot of false-positive matches, it is possible to disable it, either fully or partially.
'--disable-boundaryless' flag can be used to fully disable this mode.
In addition, '-br', '-bi', and '-be' options can be used to tweak which regexes should be in boundaryless mode.
Refer to the Filtration section for more information.
+ Formatting the output:
+
+ --format format_str
+
+ format_str can be equal to:
+
+ pretty - Output data in the table
+
+ json - Ouput data in json format
+
+ CUSTOM_STRING - Print data in the way you want. For every match CUSTOM_STRING will be printed and '%x' (See below for possible x values) will be substituted with a match value.
+
+ For example:
+
+ pywhat --format '%m - %n' 'google.com htb{flag}'
+
+ will print:
+
+ htb{flag} - HackTheBox Flag Format
+ google.com - Uniform Resource Locator (URL)</s>
|
tests.test_click/test_file_fixture_ip4_shodan
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<1>:<add> result = runner.invoke(main, ["-db", "118.103.238.230"])
<del> result = runner.invoke(main, ["118.103.238.230"])
|
# module: tests.test_click
def test_file_fixture_ip4_shodan():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["118.103.238.230"])
<2> assert result.exit_code == 0
<3> assert re.findall("shodan", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
===========changed ref 0===========
# module: tests.test_click
def test_file_fixture_ip4():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("Address Version 4", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_file_fixture_email2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "[email protected]"])
- result = runner.invoke(main, ["[email protected]"])
assert result.exit_code == 0
assert re.findall("Email", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_arg_parsing():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
- result = runner.invoke(main, ["1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_json_printing2():
"""Test for empty json return"""
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "", "--json"])
- result = runner.invoke(main, ["", "--json"])
assert result.output.strip("\n") == '{"File Signatures": null, "Regexes": null}'
===========changed ref 4===========
# module: tests.test_click
def test_json_printing():
"""Test for valid json"""
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "10.0.0.1", "--json"])
- result = runner.invoke(main, ["10.0.0.1", "--json"])
assert json.loads(result.output.replace("\n", ""))
===========changed ref 5===========
# module: tests.test_click
def test_nothing_found():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", ""])
- result = runner.invoke(main, [""])
assert result.exit_code == 0
assert "Nothing found!" in result.output
===========changed ref 6===========
# module: tests.test_click
def test_hello_world():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "THM{this is a flag}"])
- result = runner.invoke(main, ["THM{this is a flag}"])
assert result.exit_code == 0
assert "THM{" in result.output
===========changed ref 7===========
<s>-filenames",
is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
"""
pyWhat - Identify what something is.
Made by Bee https://twitter.com/bee_sec_san
https://github.com/bee-san
Filtration:
--rarity min:max
Rarity is how unlikely something is to be a false-positive. The higher the number, the more unlikely.
Only print entries with rarity in range [min,max]. min and max can be omitted.
Note: PyWhat by default has a rarity of 0.1. To see all matches, with many potential false positives use `0:`.
--include list
Only include entries containing at least one tag in a list. List is a comma separated list.
--exclude list
Exclude specified tags. List is a comma separated list.
Sorting:
--key key_name
Sort by the given key.
--reverse
Sort in reverse order.
Available keys:
name - Sort by the name of regex pattern
rarity - Sort by rarity
matched - Sort by a matched string
none - No sorting is done (the default)
Exporting:
--json
Return results in json format.
Boundaryless mode:
CLI tool matches strings like 'abcdTHM{hello}plze' by default because</s>
===========changed ref 8===========
<s> is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
# offset: 1
<s>
Boundaryless mode:
CLI tool matches strings like 'abcdTHM{hello}plze' by default because the boundaryless mode is enabled for regexes with a rarity of 0.1 and higher.
Since boundaryless mode may produce a lot of false-positive matches, it is possible to disable it, either fully or partially.
'--disable-boundaryless' flag can be used to fully disable this mode.
In addition, '-br', '-bi', and '-be' options can be used to tweak which regexes should be in boundaryless mode.
Refer to the Filtration section for more information.
+ Formatting the output:
+
+ --format format_str
+
+ format_str can be equal to:
+
+ pretty - Output data in the table
+
+ json - Ouput data in json format
+
+ CUSTOM_STRING - Print data in the way you want. For every match CUSTOM_STRING will be printed and '%x' (See below for possible x values) will be substituted with a match value.
+
+ For example:
+
+ pywhat --format '%m - %n' 'google.com htb{flag}'
+
+ will print:
+
+ htb{flag} - HackTheBox Flag Format
+ google.com - Uniform Resource Locator (URL)</s>
|
tests.test_click/test_file_fixture_ip6
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<1>:<add> result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
<del> result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
|
# module: tests.test_click
def test_file_fixture_ip6():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
<2> assert result.exit_code == 0
<3> assert re.findall("Address Version 6", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
===========changed ref 0===========
# module: tests.test_click
def test_file_fixture_ip4_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_file_fixture_ip4():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("Address Version 4", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_file_fixture_email2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "[email protected]"])
- result = runner.invoke(main, ["[email protected]"])
assert result.exit_code == 0
assert re.findall("Email", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_arg_parsing():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
- result = runner.invoke(main, ["1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_json_printing2():
"""Test for empty json return"""
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "", "--json"])
- result = runner.invoke(main, ["", "--json"])
assert result.output.strip("\n") == '{"File Signatures": null, "Regexes": null}'
===========changed ref 5===========
# module: tests.test_click
def test_json_printing():
"""Test for valid json"""
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "10.0.0.1", "--json"])
- result = runner.invoke(main, ["10.0.0.1", "--json"])
assert json.loads(result.output.replace("\n", ""))
===========changed ref 6===========
# module: tests.test_click
def test_nothing_found():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", ""])
- result = runner.invoke(main, [""])
assert result.exit_code == 0
assert "Nothing found!" in result.output
===========changed ref 7===========
# module: tests.test_click
def test_hello_world():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "THM{this is a flag}"])
- result = runner.invoke(main, ["THM{this is a flag}"])
assert result.exit_code == 0
assert "THM{" in result.output
===========changed ref 8===========
<s>-filenames",
is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
"""
pyWhat - Identify what something is.
Made by Bee https://twitter.com/bee_sec_san
https://github.com/bee-san
Filtration:
--rarity min:max
Rarity is how unlikely something is to be a false-positive. The higher the number, the more unlikely.
Only print entries with rarity in range [min,max]. min and max can be omitted.
Note: PyWhat by default has a rarity of 0.1. To see all matches, with many potential false positives use `0:`.
--include list
Only include entries containing at least one tag in a list. List is a comma separated list.
--exclude list
Exclude specified tags. List is a comma separated list.
Sorting:
--key key_name
Sort by the given key.
--reverse
Sort in reverse order.
Available keys:
name - Sort by the name of regex pattern
rarity - Sort by rarity
matched - Sort by a matched string
none - No sorting is done (the default)
Exporting:
--json
Return results in json format.
Boundaryless mode:
CLI tool matches strings like 'abcdTHM{hello}plze' by default because</s>
|
tests.test_click/test_file_fixture_ip6_shodan
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<1>:<add> result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
<del> result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
|
# module: tests.test_click
def test_file_fixture_ip6_shodan():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
<2> assert result.exit_code == 0
<3> assert re.findall("shodan", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
===========changed ref 0===========
# module: tests.test_click
def test_file_fixture_ip4_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_file_fixture_ip4():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("Address Version 4", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_file_fixture_ip6():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("Address Version 6", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_file_fixture_email2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "[email protected]"])
- result = runner.invoke(main, ["[email protected]"])
assert result.exit_code == 0
assert re.findall("Email", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_arg_parsing():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
- result = runner.invoke(main, ["1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_json_printing2():
"""Test for empty json return"""
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "", "--json"])
- result = runner.invoke(main, ["", "--json"])
assert result.output.strip("\n") == '{"File Signatures": null, "Regexes": null}'
===========changed ref 6===========
# module: tests.test_click
def test_json_printing():
"""Test for valid json"""
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "10.0.0.1", "--json"])
- result = runner.invoke(main, ["10.0.0.1", "--json"])
assert json.loads(result.output.replace("\n", ""))
===========changed ref 7===========
# module: tests.test_click
def test_nothing_found():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", ""])
- result = runner.invoke(main, [""])
assert result.exit_code == 0
assert "Nothing found!" in result.output
===========changed ref 8===========
# module: tests.test_click
def test_hello_world():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "THM{this is a flag}"])
- result = runner.invoke(main, ["THM{this is a flag}"])
assert result.exit_code == 0
assert "THM{" in result.output
===========changed ref 9===========
<s>-filenames",
is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
"""
pyWhat - Identify what something is.
Made by Bee https://twitter.com/bee_sec_san
https://github.com/bee-san
Filtration:
--rarity min:max
Rarity is how unlikely something is to be a false-positive. The higher the number, the more unlikely.
Only print entries with rarity in range [min,max]. min and max can be omitted.
Note: PyWhat by default has a rarity of 0.1. To see all matches, with many potential false positives use `0:`.
--include list
Only include entries containing at least one tag in a list. List is a comma separated list.
--exclude list
Exclude specified tags. List is a comma separated list.
Sorting:
--key key_name
Sort by the given key.
--reverse
Sort in reverse order.
Available keys:
name - Sort by the name of regex pattern
rarity - Sort by rarity
matched - Sort by a matched string
none - No sorting is done (the default)
Exporting:
--json
Return results in json format.
Boundaryless mode:
CLI tool matches strings like 'abcdTHM{hello}plze' by default because</s>
|
tests.test_click/test_file_coords
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<1>:<add> result = runner.invoke(main, ["-db", "52.6169586, -1.9779857"])
<del> result = runner.invoke(main, ["52.6169586, -1.9779857"])
|
# module: tests.test_click
def test_file_coords():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["52.6169586, -1.9779857"])
<2> assert result.exit_code == 0
<3> assert re.findall("Latitude", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
===========changed ref 0===========
# module: tests.test_click
def test_file_fixture_ip4_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_file_fixture_ip4():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("Address Version 4", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_file_fixture_ip6_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_file_fixture_ip6():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("Address Version 6", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_file_fixture_email2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "[email protected]"])
- result = runner.invoke(main, ["[email protected]"])
assert result.exit_code == 0
assert re.findall("Email", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_arg_parsing():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
- result = runner.invoke(main, ["1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_json_printing2():
"""Test for empty json return"""
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "", "--json"])
- result = runner.invoke(main, ["", "--json"])
assert result.output.strip("\n") == '{"File Signatures": null, "Regexes": null}'
===========changed ref 7===========
# module: tests.test_click
def test_json_printing():
"""Test for valid json"""
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "10.0.0.1", "--json"])
- result = runner.invoke(main, ["10.0.0.1", "--json"])
assert json.loads(result.output.replace("\n", ""))
===========changed ref 8===========
# module: tests.test_click
def test_nothing_found():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", ""])
- result = runner.invoke(main, [""])
assert result.exit_code == 0
assert "Nothing found!" in result.output
===========changed ref 9===========
# module: tests.test_click
def test_hello_world():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "THM{this is a flag}"])
- result = runner.invoke(main, ["THM{this is a flag}"])
assert result.exit_code == 0
assert "THM{" in result.output
===========changed ref 10===========
<s>-filenames",
is_flag=True,
help="Search filenames for possible matches.",
)
@click.option(
"--format",
required=False,
+ help="Format output according to specified rules.",
- help="--format json for json output. --format pretty for a pretty table output.",
)
+ @click.option("-pt", "--print-tags", is_flag=True, help="Add flags to ouput")
def main(**kwargs):
"""
pyWhat - Identify what something is.
Made by Bee https://twitter.com/bee_sec_san
https://github.com/bee-san
Filtration:
--rarity min:max
Rarity is how unlikely something is to be a false-positive. The higher the number, the more unlikely.
Only print entries with rarity in range [min,max]. min and max can be omitted.
Note: PyWhat by default has a rarity of 0.1. To see all matches, with many potential false positives use `0:`.
--include list
Only include entries containing at least one tag in a list. List is a comma separated list.
--exclude list
Exclude specified tags. List is a comma separated list.
Sorting:
--key key_name
Sort by the given key.
--reverse
Sort in reverse order.
Available keys:
name - Sort by the name of regex pattern
rarity - Sort by rarity
matched - Sort by a matched string
none - No sorting is done (the default)
Exporting:
--json
Return results in json format.
Boundaryless mode:
CLI tool matches strings like 'abcdTHM{hello}plze' by default because</s>
|
tests.test_click/test_file_fixture_bch2
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<2>:<add> main, ["-db", "bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
<del> main, ["bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
|
# module: tests.test_click
def test_file_fixture_bch2():
<0> runner = CliRunner()
<1> result = runner.invoke(
<2> main, ["bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
<3> )
<4> assert result.exit_code == 0
<5> assert re.findall("blockchain", str(result.output))
<6>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
===========changed ref 0===========
# module: tests.test_click
def test_file_coords():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "52.6169586, -1.9779857"])
- result = runner.invoke(main, ["52.6169586, -1.9779857"])
assert result.exit_code == 0
assert re.findall("Latitude", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_file_fixture_ip4_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_file_fixture_ip4():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("Address Version 4", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_file_fixture_ip6_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_file_fixture_ip6():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("Address Version 6", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_file_fixture_email2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "[email protected]"])
- result = runner.invoke(main, ["[email protected]"])
assert result.exit_code == 0
assert re.findall("Email", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_arg_parsing():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
- result = runner.invoke(main, ["1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_json_printing2():
"""Test for empty json return"""
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "", "--json"])
- result = runner.invoke(main, ["", "--json"])
assert result.output.strip("\n") == '{"File Signatures": null, "Regexes": null}'
===========changed ref 8===========
# module: tests.test_click
def test_json_printing():
"""Test for valid json"""
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "10.0.0.1", "--json"])
- result = runner.invoke(main, ["10.0.0.1", "--json"])
assert json.loads(result.output.replace("\n", ""))
===========changed ref 9===========
# module: tests.test_click
def test_nothing_found():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", ""])
- result = runner.invoke(main, [""])
assert result.exit_code == 0
assert "Nothing found!" in result.output
===========changed ref 10===========
# module: tests.test_click
def test_hello_world():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "THM{this is a flag}"])
- result = runner.invoke(main, ["THM{this is a flag}"])
assert result.exit_code == 0
assert "THM{" in result.output
|
tests.test_click/test_file_cors
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<1>:<add> result = runner.invoke(main, ["-db", "Access-Control-Allow: *"])
<del> result = runner.invoke(main, ["Access-Control-Allow: *"])
|
# module: tests.test_click
def test_file_cors():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["Access-Control-Allow: *"])
<2> assert result.exit_code == 0
<3> assert re.findall("Access", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
===========changed ref 0===========
# module: tests.test_click
def test_file_coords():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "52.6169586, -1.9779857"])
- result = runner.invoke(main, ["52.6169586, -1.9779857"])
assert result.exit_code == 0
assert re.findall("Latitude", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_file_fixture_bch2():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
- main, ["bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
)
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_file_fixture_ip4_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_file_fixture_ip4():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("Address Version 4", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_file_fixture_ip6_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_file_fixture_ip6():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("Address Version 6", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_file_fixture_email2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "[email protected]"])
- result = runner.invoke(main, ["[email protected]"])
assert result.exit_code == 0
assert re.findall("Email", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_arg_parsing():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
- result = runner.invoke(main, ["1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_json_printing2():
"""Test for empty json return"""
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "", "--json"])
- result = runner.invoke(main, ["", "--json"])
assert result.output.strip("\n") == '{"File Signatures": null, "Regexes": null}'
===========changed ref 9===========
# module: tests.test_click
def test_json_printing():
"""Test for valid json"""
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "10.0.0.1", "--json"])
- result = runner.invoke(main, ["10.0.0.1", "--json"])
assert json.loads(result.output.replace("\n", ""))
===========changed ref 10===========
# module: tests.test_click
def test_nothing_found():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", ""])
- result = runner.invoke(main, [""])
assert result.exit_code == 0
assert "Nothing found!" in result.output
===========changed ref 11===========
# module: tests.test_click
def test_hello_world():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "THM{this is a flag}"])
- result = runner.invoke(main, ["THM{this is a flag}"])
assert result.exit_code == 0
assert "THM{" in result.output
|
tests.test_click/test_file_jwt
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<4>:<add> "-db",
<add> "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
<del> "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
|
# module: tests.test_click
def test_file_jwt():
<0> runner = CliRunner()
<1> result = runner.invoke(
<2> main,
<3> [
<4> "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
<5> ],
<6> )
<7> assert result.exit_code == 0
<8> assert re.findall("JWT", str(result.output))
<9>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
===========changed ref 0===========
# module: tests.test_click
def test_file_cors():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "Access-Control-Allow: *"])
- result = runner.invoke(main, ["Access-Control-Allow: *"])
assert result.exit_code == 0
assert re.findall("Access", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_file_coords():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "52.6169586, -1.9779857"])
- result = runner.invoke(main, ["52.6169586, -1.9779857"])
assert result.exit_code == 0
assert re.findall("Latitude", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_file_fixture_bch2():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
- main, ["bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
)
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_file_fixture_ip4_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_file_fixture_ip4():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("Address Version 4", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_file_fixture_ip6_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_file_fixture_ip6():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("Address Version 6", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_file_fixture_email2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "[email protected]"])
- result = runner.invoke(main, ["[email protected]"])
assert result.exit_code == 0
assert re.findall("Email", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_arg_parsing():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
- result = runner.invoke(main, ["1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_json_printing2():
"""Test for empty json return"""
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "", "--json"])
- result = runner.invoke(main, ["", "--json"])
assert result.output.strip("\n") == '{"File Signatures": null, "Regexes": null}'
===========changed ref 10===========
# module: tests.test_click
def test_json_printing():
"""Test for valid json"""
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "10.0.0.1", "--json"])
- result = runner.invoke(main, ["10.0.0.1", "--json"])
assert json.loads(result.output.replace("\n", ""))
===========changed ref 11===========
# module: tests.test_click
def test_nothing_found():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", ""])
- result = runner.invoke(main, [""])
assert result.exit_code == 0
assert "Nothing found!" in result.output
===========changed ref 12===========
# module: tests.test_click
def test_hello_world():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "THM{this is a flag}"])
- result = runner.invoke(main, ["THM{this is a flag}"])
assert result.exit_code == 0
assert "THM{" in result.output
|
tests.test_click/test_file_s3
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<1>:<add> result = runner.invoke(main, ["-db", "http://s3.amazonaws.com/bucket/"])
<del> result = runner.invoke(main, ["http://s3.amazonaws.com/bucket/"])
|
# module: tests.test_click
def test_file_s3():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["http://s3.amazonaws.com/bucket/"])
<2> assert result.exit_code == 0
<3> assert re.findall("S3", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
at: tests.test_click.test_file_jwt
result = runner.invoke(
main,
[
"-db",
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
],
)
===========changed ref 0===========
# module: tests.test_click
def test_file_cors():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "Access-Control-Allow: *"])
- result = runner.invoke(main, ["Access-Control-Allow: *"])
assert result.exit_code == 0
assert re.findall("Access", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_file_coords():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "52.6169586, -1.9779857"])
- result = runner.invoke(main, ["52.6169586, -1.9779857"])
assert result.exit_code == 0
assert re.findall("Latitude", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_file_fixture_bch2():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
- main, ["bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
)
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_file_fixture_ip4_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_file_fixture_ip4():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("Address Version 4", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_file_fixture_ip6_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_file_fixture_ip6():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("Address Version 6", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_file_fixture_email2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "[email protected]"])
- result = runner.invoke(main, ["[email protected]"])
assert result.exit_code == 0
assert re.findall("Email", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_arg_parsing():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
- result = runner.invoke(main, ["1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_file_jwt():
runner = CliRunner()
result = runner.invoke(
main,
[
+ "-db",
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
- "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
],
)
assert result.exit_code == 0
assert re.findall("JWT", str(result.output))
|
tests.test_click/test_file_s3_2
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<1>:<add> result = runner.invoke(main, ["-db", "s3://bucket/path/key"])
<del> result = runner.invoke(main, ["s3://bucket/path/key"])
|
# module: tests.test_click
def test_file_s3_2():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["s3://bucket/path/key"])
<2> assert result.exit_code == 0
<3> assert re.findall("S3", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
at: tests.test_click.test_file_s3
result = runner.invoke(main, ["-db", "http://s3.amazonaws.com/bucket/"])
===========changed ref 0===========
# module: tests.test_click
def test_file_s3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "http://s3.amazonaws.com/bucket/"])
- result = runner.invoke(main, ["http://s3.amazonaws.com/bucket/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_file_cors():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "Access-Control-Allow: *"])
- result = runner.invoke(main, ["Access-Control-Allow: *"])
assert result.exit_code == 0
assert re.findall("Access", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_file_coords():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "52.6169586, -1.9779857"])
- result = runner.invoke(main, ["52.6169586, -1.9779857"])
assert result.exit_code == 0
assert re.findall("Latitude", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_file_fixture_bch2():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
- main, ["bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
)
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_file_fixture_ip4_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_file_fixture_ip4():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("Address Version 4", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_file_fixture_ip6_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_file_fixture_ip6():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("Address Version 6", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_file_fixture_email2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "[email protected]"])
- result = runner.invoke(main, ["[email protected]"])
assert result.exit_code == 0
assert re.findall("Email", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_arg_parsing():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
- result = runner.invoke(main, ["1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
===========changed ref 10===========
# module: tests.test_click
def test_file_jwt():
runner = CliRunner()
result = runner.invoke(
main,
[
+ "-db",
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
- "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
],
)
assert result.exit_code == 0
assert re.findall("JWT", str(result.output))
|
tests.test_click/test_file_s3_3
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<1>:<add> result = runner.invoke(main, ["-db", "s3://bucket/path/directory/"])
<del> result = runner.invoke(main, ["s3://bucket/path/directory/"])
|
# module: tests.test_click
def test_file_s3_3():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["s3://bucket/path/directory/"])
<2> assert result.exit_code == 0
<3> assert re.findall("S3", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
at: tests.test_click.test_file_s3_2
result = runner.invoke(main, ["-db", "s3://bucket/path/key"])
===========changed ref 0===========
# module: tests.test_click
def test_file_s3_2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/key"])
- result = runner.invoke(main, ["s3://bucket/path/key"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_file_s3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "http://s3.amazonaws.com/bucket/"])
- result = runner.invoke(main, ["http://s3.amazonaws.com/bucket/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_file_cors():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "Access-Control-Allow: *"])
- result = runner.invoke(main, ["Access-Control-Allow: *"])
assert result.exit_code == 0
assert re.findall("Access", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_file_coords():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "52.6169586, -1.9779857"])
- result = runner.invoke(main, ["52.6169586, -1.9779857"])
assert result.exit_code == 0
assert re.findall("Latitude", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_file_fixture_bch2():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
- main, ["bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
)
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_file_fixture_ip4_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_file_fixture_ip4():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("Address Version 4", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_file_fixture_ip6_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_file_fixture_ip6():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("Address Version 6", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_file_fixture_email2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "[email protected]"])
- result = runner.invoke(main, ["[email protected]"])
assert result.exit_code == 0
assert re.findall("Email", str(result.output))
===========changed ref 10===========
# module: tests.test_click
def test_arg_parsing():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
- result = runner.invoke(main, ["1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
|
tests.test_click/test_file_arn
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<1>:<add> result = runner.invoke(
<add> main, ["-db", "arn:partition:service:region:account-id:resource"]
<del> result = runner.invoke(main, ["arn:partition:service:region:account-id:resource"])
<2>:<add> )
|
# module: tests.test_click
def test_file_arn():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["arn:partition:service:region:account-id:resource"])
<2> assert result.exit_code == 0
<3> assert re.findall("ARN", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
at: tests.test_click.test_file_s3_3
result = runner.invoke(main, ["-db", "s3://bucket/path/directory/"])
===========changed ref 0===========
# module: tests.test_click
def test_file_s3_3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/directory/"])
- result = runner.invoke(main, ["s3://bucket/path/directory/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_file_s3_2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/key"])
- result = runner.invoke(main, ["s3://bucket/path/key"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_file_s3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "http://s3.amazonaws.com/bucket/"])
- result = runner.invoke(main, ["http://s3.amazonaws.com/bucket/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_file_cors():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "Access-Control-Allow: *"])
- result = runner.invoke(main, ["Access-Control-Allow: *"])
assert result.exit_code == 0
assert re.findall("Access", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_file_coords():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "52.6169586, -1.9779857"])
- result = runner.invoke(main, ["52.6169586, -1.9779857"])
assert result.exit_code == 0
assert re.findall("Latitude", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_file_fixture_bch2():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
- main, ["bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
)
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_file_fixture_ip4_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_file_fixture_ip4():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("Address Version 4", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_file_fixture_ip6_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_file_fixture_ip6():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("Address Version 6", str(result.output))
===========changed ref 10===========
# module: tests.test_click
def test_file_fixture_email2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "[email protected]"])
- result = runner.invoke(main, ["[email protected]"])
assert result.exit_code == 0
assert re.findall("Email", str(result.output))
===========changed ref 11===========
# module: tests.test_click
def test_arg_parsing():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
- result = runner.invoke(main, ["1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
|
tests.test_click/test_file_arn2
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<2>:<add> main, ["-db", "arn:partition:service:region:account-id:resourcetype/resource"]
<del> main, ["arn:partition:service:region:account-id:resourcetype/resource"]
|
# module: tests.test_click
def test_file_arn2():
<0> runner = CliRunner()
<1> result = runner.invoke(
<2> main, ["arn:partition:service:region:account-id:resourcetype/resource"]
<3> )
<4> assert result.exit_code == 0
<5> assert re.findall("ARN", str(result.output))
<6>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
at: tests.test_click.test_file_arn
result = runner.invoke(
main, ["-db", "arn:partition:service:region:account-id:resource"]
)
===========changed ref 0===========
# module: tests.test_click
def test_file_s3_3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/directory/"])
- result = runner.invoke(main, ["s3://bucket/path/directory/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_file_s3_2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/key"])
- result = runner.invoke(main, ["s3://bucket/path/key"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_file_arn():
runner = CliRunner()
+ result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resource"]
- result = runner.invoke(main, ["arn:partition:service:region:account-id:resource"])
+ )
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_file_s3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "http://s3.amazonaws.com/bucket/"])
- result = runner.invoke(main, ["http://s3.amazonaws.com/bucket/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_file_cors():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "Access-Control-Allow: *"])
- result = runner.invoke(main, ["Access-Control-Allow: *"])
assert result.exit_code == 0
assert re.findall("Access", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_file_coords():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "52.6169586, -1.9779857"])
- result = runner.invoke(main, ["52.6169586, -1.9779857"])
assert result.exit_code == 0
assert re.findall("Latitude", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_file_fixture_bch2():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
- main, ["bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
)
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_file_fixture_ip4_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_file_fixture_ip4():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("Address Version 4", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_file_fixture_ip6_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 10===========
# module: tests.test_click
def test_file_fixture_ip6():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("Address Version 6", str(result.output))
===========changed ref 11===========
# module: tests.test_click
def test_file_fixture_email2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "[email protected]"])
- result = runner.invoke(main, ["[email protected]"])
assert result.exit_code == 0
assert re.findall("Email", str(result.output))
===========changed ref 12===========
# module: tests.test_click
def test_arg_parsing():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
- result = runner.invoke(main, ["1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
|
tests.test_click/test_file_arn3
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<2>:<add> main, ["-db", "arn:partition:service:region:account-id:resourcetype:resource"]
<del> main, ["arn:partition:service:region:account-id:resourcetype:resource"]
|
# module: tests.test_click
def test_file_arn3():
<0> runner = CliRunner()
<1> result = runner.invoke(
<2> main, ["arn:partition:service:region:account-id:resourcetype:resource"]
<3> )
<4> assert result.exit_code == 0
<5> assert re.findall("ARN", str(result.output))
<6>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
at: tests.test_click.test_file_arn2
result = runner.invoke(
main, ["-db", "arn:partition:service:region:account-id:resourcetype/resource"]
)
===========changed ref 0===========
# module: tests.test_click
def test_file_arn2():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resourcetype/resource"]
- main, ["arn:partition:service:region:account-id:resourcetype/resource"]
)
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_file_s3_3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/directory/"])
- result = runner.invoke(main, ["s3://bucket/path/directory/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_file_s3_2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/key"])
- result = runner.invoke(main, ["s3://bucket/path/key"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_file_arn():
runner = CliRunner()
+ result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resource"]
- result = runner.invoke(main, ["arn:partition:service:region:account-id:resource"])
+ )
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_file_s3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "http://s3.amazonaws.com/bucket/"])
- result = runner.invoke(main, ["http://s3.amazonaws.com/bucket/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_file_cors():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "Access-Control-Allow: *"])
- result = runner.invoke(main, ["Access-Control-Allow: *"])
assert result.exit_code == 0
assert re.findall("Access", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_file_coords():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "52.6169586, -1.9779857"])
- result = runner.invoke(main, ["52.6169586, -1.9779857"])
assert result.exit_code == 0
assert re.findall("Latitude", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_file_fixture_bch2():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
- main, ["bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
)
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_file_fixture_ip4_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_file_fixture_ip4():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("Address Version 4", str(result.output))
===========changed ref 10===========
# module: tests.test_click
def test_file_fixture_ip6_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 11===========
# module: tests.test_click
def test_file_fixture_ip6():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("Address Version 6", str(result.output))
===========changed ref 12===========
# module: tests.test_click
def test_file_fixture_email2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "[email protected]"])
- result = runner.invoke(main, ["[email protected]"])
assert result.exit_code == 0
assert re.findall("Email", str(result.output))
|
tests.test_click/test_file_arn4
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<1>:<add> result = runner.invoke(
<add> main, ["-db", "arn:aws:s3:::my_corporate_bucket/Development/*"]
<del> result = runner.invoke(main, ["arn:aws:s3:::my_corporate_bucket/Development/*"])
<2>:<add> )
|
# module: tests.test_click
def test_file_arn4():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["arn:aws:s3:::my_corporate_bucket/Development/*"])
<2> assert result.exit_code == 0
<3> assert re.findall("ARN", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
at: tests.test_click.test_file_arn3
result = runner.invoke(
main, ["-db", "arn:partition:service:region:account-id:resourcetype:resource"]
)
===========changed ref 0===========
# module: tests.test_click
def test_file_arn3():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resourcetype:resource"]
- main, ["arn:partition:service:region:account-id:resourcetype:resource"]
)
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_file_arn2():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resourcetype/resource"]
- main, ["arn:partition:service:region:account-id:resourcetype/resource"]
)
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_file_s3_3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/directory/"])
- result = runner.invoke(main, ["s3://bucket/path/directory/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_file_s3_2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/key"])
- result = runner.invoke(main, ["s3://bucket/path/key"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_file_arn():
runner = CliRunner()
+ result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resource"]
- result = runner.invoke(main, ["arn:partition:service:region:account-id:resource"])
+ )
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_file_s3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "http://s3.amazonaws.com/bucket/"])
- result = runner.invoke(main, ["http://s3.amazonaws.com/bucket/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_file_cors():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "Access-Control-Allow: *"])
- result = runner.invoke(main, ["Access-Control-Allow: *"])
assert result.exit_code == 0
assert re.findall("Access", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_file_coords():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "52.6169586, -1.9779857"])
- result = runner.invoke(main, ["52.6169586, -1.9779857"])
assert result.exit_code == 0
assert re.findall("Latitude", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_file_fixture_bch2():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
- main, ["bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
)
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_file_fixture_ip4_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 10===========
# module: tests.test_click
def test_file_fixture_ip4():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("Address Version 4", str(result.output))
===========changed ref 11===========
# module: tests.test_click
def test_file_fixture_ip6_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 12===========
# module: tests.test_click
def test_file_fixture_ip6():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("Address Version 6", str(result.output))
===========changed ref 13===========
# module: tests.test_click
def test_file_fixture_email2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "[email protected]"])
- result = runner.invoke(main, ["[email protected]"])
assert result.exit_code == 0
assert re.findall("Email", str(result.output))
|
tests.test_click/test_key_value_min_rarity_0
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<1>:<add> result = runner.invoke(main, ["-db", "--rarity", "0:", "key:value"])
<del> result = runner.invoke(main, ["--rarity", "0:", "key:value"])
|
# module: tests.test_click
def test_key_value_min_rarity_0():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["--rarity", "0:", "key:value"])
<2> assert result.exit_code == 0
<3> assert re.findall("Key:Value", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
at: tests.test_click.test_file_arn4
runner = CliRunner()
===========changed ref 0===========
# module: tests.test_click
def test_file_arn3():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resourcetype:resource"]
- main, ["arn:partition:service:region:account-id:resourcetype:resource"]
)
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_file_arn4():
runner = CliRunner()
+ result = runner.invoke(
+ main, ["-db", "arn:aws:s3:::my_corporate_bucket/Development/*"]
- result = runner.invoke(main, ["arn:aws:s3:::my_corporate_bucket/Development/*"])
+ )
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_file_arn2():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resourcetype/resource"]
- main, ["arn:partition:service:region:account-id:resourcetype/resource"]
)
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_file_s3_3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/directory/"])
- result = runner.invoke(main, ["s3://bucket/path/directory/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_file_s3_2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/key"])
- result = runner.invoke(main, ["s3://bucket/path/key"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_file_arn():
runner = CliRunner()
+ result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resource"]
- result = runner.invoke(main, ["arn:partition:service:region:account-id:resource"])
+ )
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_file_s3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "http://s3.amazonaws.com/bucket/"])
- result = runner.invoke(main, ["http://s3.amazonaws.com/bucket/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_file_cors():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "Access-Control-Allow: *"])
- result = runner.invoke(main, ["Access-Control-Allow: *"])
assert result.exit_code == 0
assert re.findall("Access", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_file_coords():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "52.6169586, -1.9779857"])
- result = runner.invoke(main, ["52.6169586, -1.9779857"])
assert result.exit_code == 0
assert re.findall("Latitude", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_file_fixture_bch2():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
- main, ["bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
)
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
===========changed ref 10===========
# module: tests.test_click
def test_file_fixture_ip4_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 11===========
# module: tests.test_click
def test_file_fixture_ip4():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("Address Version 4", str(result.output))
===========changed ref 12===========
# module: tests.test_click
def test_file_fixture_ip6_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 13===========
# module: tests.test_click
def test_file_fixture_ip6():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("Address Version 6", str(result.output))
|
tests.test_click/test_key_value_min_rarity_0_1
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<1>:<add> result = runner.invoke(main, ["-db", "--rarity", "0:", "key : value"])
<del> result = runner.invoke(main, ["--rarity", "0:", "key : value"])
|
# module: tests.test_click
def test_key_value_min_rarity_0_1():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["--rarity", "0:", "key : value"])
<2> assert result.exit_code == 0
<3> assert re.findall("Key:Value", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
===========changed ref 0===========
# module: tests.test_click
def test_key_value_min_rarity_0():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", "key:value"])
- result = runner.invoke(main, ["--rarity", "0:", "key:value"])
assert result.exit_code == 0
assert re.findall("Key:Value", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_file_arn3():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resourcetype:resource"]
- main, ["arn:partition:service:region:account-id:resourcetype:resource"]
)
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_file_arn4():
runner = CliRunner()
+ result = runner.invoke(
+ main, ["-db", "arn:aws:s3:::my_corporate_bucket/Development/*"]
- result = runner.invoke(main, ["arn:aws:s3:::my_corporate_bucket/Development/*"])
+ )
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_file_arn2():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resourcetype/resource"]
- main, ["arn:partition:service:region:account-id:resourcetype/resource"]
)
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_file_s3_3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/directory/"])
- result = runner.invoke(main, ["s3://bucket/path/directory/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_file_s3_2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/key"])
- result = runner.invoke(main, ["s3://bucket/path/key"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_file_arn():
runner = CliRunner()
+ result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resource"]
- result = runner.invoke(main, ["arn:partition:service:region:account-id:resource"])
+ )
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_file_s3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "http://s3.amazonaws.com/bucket/"])
- result = runner.invoke(main, ["http://s3.amazonaws.com/bucket/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_file_cors():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "Access-Control-Allow: *"])
- result = runner.invoke(main, ["Access-Control-Allow: *"])
assert result.exit_code == 0
assert re.findall("Access", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_file_coords():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "52.6169586, -1.9779857"])
- result = runner.invoke(main, ["52.6169586, -1.9779857"])
assert result.exit_code == 0
assert re.findall("Latitude", str(result.output))
===========changed ref 10===========
# module: tests.test_click
def test_file_fixture_bch2():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
- main, ["bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
)
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
===========changed ref 11===========
# module: tests.test_click
def test_file_fixture_ip4_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 12===========
# module: tests.test_click
def test_file_fixture_ip4():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("Address Version 4", str(result.output))
===========changed ref 13===========
# module: tests.test_click
def test_file_fixture_ip6_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
|
tests.test_click/test_key_value_min_rarity_0_2
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<1>:<add> result = runner.invoke(main, ["-db", "--rarity", "0:", "key: value"])
<del> result = runner.invoke(main, ["--rarity", "0:", "key: value"])
|
# module: tests.test_click
def test_key_value_min_rarity_0_2():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["--rarity", "0:", "key: value"])
<2> assert result.exit_code == 0
<3> assert re.findall("Key:Value", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
===========changed ref 0===========
# module: tests.test_click
def test_key_value_min_rarity_0_1():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", "key : value"])
- result = runner.invoke(main, ["--rarity", "0:", "key : value"])
assert result.exit_code == 0
assert re.findall("Key:Value", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_key_value_min_rarity_0():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", "key:value"])
- result = runner.invoke(main, ["--rarity", "0:", "key:value"])
assert result.exit_code == 0
assert re.findall("Key:Value", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_file_arn3():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resourcetype:resource"]
- main, ["arn:partition:service:region:account-id:resourcetype:resource"]
)
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_file_arn4():
runner = CliRunner()
+ result = runner.invoke(
+ main, ["-db", "arn:aws:s3:::my_corporate_bucket/Development/*"]
- result = runner.invoke(main, ["arn:aws:s3:::my_corporate_bucket/Development/*"])
+ )
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_file_arn2():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resourcetype/resource"]
- main, ["arn:partition:service:region:account-id:resourcetype/resource"]
)
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_file_s3_3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/directory/"])
- result = runner.invoke(main, ["s3://bucket/path/directory/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_file_s3_2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/key"])
- result = runner.invoke(main, ["s3://bucket/path/key"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_file_arn():
runner = CliRunner()
+ result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resource"]
- result = runner.invoke(main, ["arn:partition:service:region:account-id:resource"])
+ )
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_file_s3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "http://s3.amazonaws.com/bucket/"])
- result = runner.invoke(main, ["http://s3.amazonaws.com/bucket/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_file_cors():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "Access-Control-Allow: *"])
- result = runner.invoke(main, ["Access-Control-Allow: *"])
assert result.exit_code == 0
assert re.findall("Access", str(result.output))
===========changed ref 10===========
# module: tests.test_click
def test_file_coords():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "52.6169586, -1.9779857"])
- result = runner.invoke(main, ["52.6169586, -1.9779857"])
assert result.exit_code == 0
assert re.findall("Latitude", str(result.output))
===========changed ref 11===========
# module: tests.test_click
def test_file_fixture_bch2():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
- main, ["bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
)
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
===========changed ref 12===========
# module: tests.test_click
def test_file_fixture_ip4_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
===========changed ref 13===========
# module: tests.test_click
def test_file_fixture_ip4():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("Address Version 4", str(result.output))
|
tests.test_click/test_key_value_min_rarity_0_3
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<1>:<add> result = runner.invoke(main, ["-db", "--rarity", "0:", ":a:"])
<del> result = runner.invoke(main, ["--rarity", "0:", ":a:"])
|
# module: tests.test_click
def test_key_value_min_rarity_0_3():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["--rarity", "0:", ":a:"])
<2> assert result.exit_code == 0
<3> assert not re.findall("Key:Value", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
===========changed ref 0===========
# module: tests.test_click
def test_key_value_min_rarity_0_2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", "key: value"])
- result = runner.invoke(main, ["--rarity", "0:", "key: value"])
assert result.exit_code == 0
assert re.findall("Key:Value", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_key_value_min_rarity_0_1():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", "key : value"])
- result = runner.invoke(main, ["--rarity", "0:", "key : value"])
assert result.exit_code == 0
assert re.findall("Key:Value", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_key_value_min_rarity_0():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", "key:value"])
- result = runner.invoke(main, ["--rarity", "0:", "key:value"])
assert result.exit_code == 0
assert re.findall("Key:Value", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_file_arn3():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resourcetype:resource"]
- main, ["arn:partition:service:region:account-id:resourcetype:resource"]
)
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_file_arn4():
runner = CliRunner()
+ result = runner.invoke(
+ main, ["-db", "arn:aws:s3:::my_corporate_bucket/Development/*"]
- result = runner.invoke(main, ["arn:aws:s3:::my_corporate_bucket/Development/*"])
+ )
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_file_arn2():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resourcetype/resource"]
- main, ["arn:partition:service:region:account-id:resourcetype/resource"]
)
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_file_s3_3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/directory/"])
- result = runner.invoke(main, ["s3://bucket/path/directory/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_file_s3_2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/key"])
- result = runner.invoke(main, ["s3://bucket/path/key"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_file_arn():
runner = CliRunner()
+ result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resource"]
- result = runner.invoke(main, ["arn:partition:service:region:account-id:resource"])
+ )
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_file_s3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "http://s3.amazonaws.com/bucket/"])
- result = runner.invoke(main, ["http://s3.amazonaws.com/bucket/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 10===========
# module: tests.test_click
def test_file_cors():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "Access-Control-Allow: *"])
- result = runner.invoke(main, ["Access-Control-Allow: *"])
assert result.exit_code == 0
assert re.findall("Access", str(result.output))
===========changed ref 11===========
# module: tests.test_click
def test_file_coords():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "52.6169586, -1.9779857"])
- result = runner.invoke(main, ["52.6169586, -1.9779857"])
assert result.exit_code == 0
assert re.findall("Latitude", str(result.output))
===========changed ref 12===========
# module: tests.test_click
def test_file_fixture_bch2():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
- main, ["bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
)
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
===========changed ref 13===========
# module: tests.test_click
def test_file_fixture_ip4_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
|
tests.test_click/test_key_value_min_rarity_0_4
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<1>:<add> result = runner.invoke(main, ["-db", "--rarity", "0:", ":::::"])
<del> result = runner.invoke(main, ["--rarity", "0:", ":::::"])
|
# module: tests.test_click
def test_key_value_min_rarity_0_4():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["--rarity", "0:", ":::::"])
<2> assert result.exit_code == 0
<3> assert not re.findall("Key:Value", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
===========changed ref 0===========
# module: tests.test_click
def test_key_value_min_rarity_0_3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", ":a:"])
- result = runner.invoke(main, ["--rarity", "0:", ":a:"])
assert result.exit_code == 0
assert not re.findall("Key:Value", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_key_value_min_rarity_0_2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", "key: value"])
- result = runner.invoke(main, ["--rarity", "0:", "key: value"])
assert result.exit_code == 0
assert re.findall("Key:Value", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_key_value_min_rarity_0_1():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", "key : value"])
- result = runner.invoke(main, ["--rarity", "0:", "key : value"])
assert result.exit_code == 0
assert re.findall("Key:Value", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_key_value_min_rarity_0():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", "key:value"])
- result = runner.invoke(main, ["--rarity", "0:", "key:value"])
assert result.exit_code == 0
assert re.findall("Key:Value", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_file_arn3():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resourcetype:resource"]
- main, ["arn:partition:service:region:account-id:resourcetype:resource"]
)
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_file_arn4():
runner = CliRunner()
+ result = runner.invoke(
+ main, ["-db", "arn:aws:s3:::my_corporate_bucket/Development/*"]
- result = runner.invoke(main, ["arn:aws:s3:::my_corporate_bucket/Development/*"])
+ )
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_file_arn2():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resourcetype/resource"]
- main, ["arn:partition:service:region:account-id:resourcetype/resource"]
)
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_file_s3_3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/directory/"])
- result = runner.invoke(main, ["s3://bucket/path/directory/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_file_s3_2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/key"])
- result = runner.invoke(main, ["s3://bucket/path/key"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_file_arn():
runner = CliRunner()
+ result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resource"]
- result = runner.invoke(main, ["arn:partition:service:region:account-id:resource"])
+ )
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 10===========
# module: tests.test_click
def test_file_s3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "http://s3.amazonaws.com/bucket/"])
- result = runner.invoke(main, ["http://s3.amazonaws.com/bucket/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 11===========
# module: tests.test_click
def test_file_cors():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "Access-Control-Allow: *"])
- result = runner.invoke(main, ["Access-Control-Allow: *"])
assert result.exit_code == 0
assert re.findall("Access", str(result.output))
===========changed ref 12===========
# module: tests.test_click
def test_file_coords():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "52.6169586, -1.9779857"])
- result = runner.invoke(main, ["52.6169586, -1.9779857"])
assert result.exit_code == 0
assert re.findall("Latitude", str(result.output))
===========changed ref 13===========
# module: tests.test_click
def test_file_fixture_bch2():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
- main, ["bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
)
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
|
tests.test_click/test_key_value_min_rarity_0_5
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<1>:<add> result = runner.invoke(main, ["-db", "--rarity", "0:", "a:b:c"])
<del> result = runner.invoke(main, ["--rarity", "0:", "a:b:c"])
|
# module: tests.test_click
def test_key_value_min_rarity_0_5():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["--rarity", "0:", "a:b:c"])
<2> assert result.exit_code == 0
<3> assert not re.findall("a:b:c", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
===========changed ref 0===========
# module: tests.test_click
def test_key_value_min_rarity_0_4():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", ":::::"])
- result = runner.invoke(main, ["--rarity", "0:", ":::::"])
assert result.exit_code == 0
assert not re.findall("Key:Value", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_key_value_min_rarity_0_3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", ":a:"])
- result = runner.invoke(main, ["--rarity", "0:", ":a:"])
assert result.exit_code == 0
assert not re.findall("Key:Value", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_key_value_min_rarity_0_2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", "key: value"])
- result = runner.invoke(main, ["--rarity", "0:", "key: value"])
assert result.exit_code == 0
assert re.findall("Key:Value", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_key_value_min_rarity_0_1():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", "key : value"])
- result = runner.invoke(main, ["--rarity", "0:", "key : value"])
assert result.exit_code == 0
assert re.findall("Key:Value", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_key_value_min_rarity_0():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", "key:value"])
- result = runner.invoke(main, ["--rarity", "0:", "key:value"])
assert result.exit_code == 0
assert re.findall("Key:Value", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_file_arn3():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resourcetype:resource"]
- main, ["arn:partition:service:region:account-id:resourcetype:resource"]
)
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_file_arn4():
runner = CliRunner()
+ result = runner.invoke(
+ main, ["-db", "arn:aws:s3:::my_corporate_bucket/Development/*"]
- result = runner.invoke(main, ["arn:aws:s3:::my_corporate_bucket/Development/*"])
+ )
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_file_arn2():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resourcetype/resource"]
- main, ["arn:partition:service:region:account-id:resourcetype/resource"]
)
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_file_s3_3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/directory/"])
- result = runner.invoke(main, ["s3://bucket/path/directory/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_file_s3_2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/key"])
- result = runner.invoke(main, ["s3://bucket/path/key"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 10===========
# module: tests.test_click
def test_file_arn():
runner = CliRunner()
+ result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resource"]
- result = runner.invoke(main, ["arn:partition:service:region:account-id:resource"])
+ )
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 11===========
# module: tests.test_click
def test_file_s3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "http://s3.amazonaws.com/bucket/"])
- result = runner.invoke(main, ["http://s3.amazonaws.com/bucket/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 12===========
# module: tests.test_click
def test_file_cors():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "Access-Control-Allow: *"])
- result = runner.invoke(main, ["Access-Control-Allow: *"])
assert result.exit_code == 0
assert re.findall("Access", str(result.output))
===========changed ref 13===========
# module: tests.test_click
def test_file_coords():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "52.6169586, -1.9779857"])
- result = runner.invoke(main, ["52.6169586, -1.9779857"])
assert result.exit_code == 0
assert re.findall("Latitude", str(result.output))
|
tests.test_click/test_file_fixture_date_of_birth
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<1>:<add> result = runner.invoke(main, ["-db", "fixtures/file"])
<del> result = runner.invoke(main, ["fixtures/file"])
|
# module: tests.test_click
def test_file_fixture_date_of_birth():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["fixtures/file"])
<2> assert result.exit_code == 0
<3> assert re.findall("Date of Birth", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
===========changed ref 0===========
# module: tests.test_click
def test_key_value_min_rarity_0_4():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", ":::::"])
- result = runner.invoke(main, ["--rarity", "0:", ":::::"])
assert result.exit_code == 0
assert not re.findall("Key:Value", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_key_value_min_rarity_0_5():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", "a:b:c"])
- result = runner.invoke(main, ["--rarity", "0:", "a:b:c"])
assert result.exit_code == 0
assert not re.findall("a:b:c", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_key_value_min_rarity_0_3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", ":a:"])
- result = runner.invoke(main, ["--rarity", "0:", ":a:"])
assert result.exit_code == 0
assert not re.findall("Key:Value", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_key_value_min_rarity_0_2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", "key: value"])
- result = runner.invoke(main, ["--rarity", "0:", "key: value"])
assert result.exit_code == 0
assert re.findall("Key:Value", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_key_value_min_rarity_0_1():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", "key : value"])
- result = runner.invoke(main, ["--rarity", "0:", "key : value"])
assert result.exit_code == 0
assert re.findall("Key:Value", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_key_value_min_rarity_0():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", "key:value"])
- result = runner.invoke(main, ["--rarity", "0:", "key:value"])
assert result.exit_code == 0
assert re.findall("Key:Value", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_file_arn3():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resourcetype:resource"]
- main, ["arn:partition:service:region:account-id:resourcetype:resource"]
)
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_file_arn4():
runner = CliRunner()
+ result = runner.invoke(
+ main, ["-db", "arn:aws:s3:::my_corporate_bucket/Development/*"]
- result = runner.invoke(main, ["arn:aws:s3:::my_corporate_bucket/Development/*"])
+ )
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_file_arn2():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resourcetype/resource"]
- main, ["arn:partition:service:region:account-id:resourcetype/resource"]
)
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_file_s3_3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/directory/"])
- result = runner.invoke(main, ["s3://bucket/path/directory/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 10===========
# module: tests.test_click
def test_file_s3_2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/key"])
- result = runner.invoke(main, ["s3://bucket/path/key"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 11===========
# module: tests.test_click
def test_file_arn():
runner = CliRunner()
+ result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resource"]
- result = runner.invoke(main, ["arn:partition:service:region:account-id:resource"])
+ )
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 12===========
# module: tests.test_click
def test_file_s3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "http://s3.amazonaws.com/bucket/"])
- result = runner.invoke(main, ["http://s3.amazonaws.com/bucket/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 13===========
# module: tests.test_click
def test_file_cors():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "Access-Control-Allow: *"])
- result = runner.invoke(main, ["Access-Control-Allow: *"])
assert result.exit_code == 0
assert re.findall("Access", str(result.output))
|
tests.test_click/test_file_fixture_turkish_id_number
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
<1>:<add> result = runner.invoke(main, ["-db", "fixtures/file"])
<del> result = runner.invoke(main, ["fixtures/file"])
|
# module: tests.test_click
def test_file_fixture_turkish_id_number():
<0> runner = CliRunner()
<1> result = runner.invoke(main, ["fixtures/file"])
<2> assert result.exit_code == 0
<3> assert re.findall("Turkish Identification Number", str(result.output))
<4>
|
===========unchanged ref 0===========
at: click.testing
CliRunner(charset: Optional[Text]=..., env: Optional[Mapping[str, str]]=..., echo_stdin: bool=..., mix_stderr: bool=...)
at: click.testing.CliRunner
invoke(cli: BaseCommand, args: Optional[Union[str, Iterable[str]]]=..., input: Optional[Union[bytes, Text, IO[Any]]]=..., env: Optional[Mapping[str, str]]=..., catch_exceptions: bool=..., color: bool=..., **extra: Any) -> Result
at: pywhat.what
main(**kwargs)
at: re
findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType=...) -> List[Any]
findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> List[Any]
===========changed ref 0===========
# module: tests.test_click
def test_file_fixture_date_of_birth():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Date of Birth", str(result.output))
===========changed ref 1===========
# module: tests.test_click
def test_key_value_min_rarity_0_4():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", ":::::"])
- result = runner.invoke(main, ["--rarity", "0:", ":::::"])
assert result.exit_code == 0
assert not re.findall("Key:Value", str(result.output))
===========changed ref 2===========
# module: tests.test_click
def test_key_value_min_rarity_0_5():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", "a:b:c"])
- result = runner.invoke(main, ["--rarity", "0:", "a:b:c"])
assert result.exit_code == 0
assert not re.findall("a:b:c", str(result.output))
===========changed ref 3===========
# module: tests.test_click
def test_key_value_min_rarity_0_3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", ":a:"])
- result = runner.invoke(main, ["--rarity", "0:", ":a:"])
assert result.exit_code == 0
assert not re.findall("Key:Value", str(result.output))
===========changed ref 4===========
# module: tests.test_click
def test_key_value_min_rarity_0_2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", "key: value"])
- result = runner.invoke(main, ["--rarity", "0:", "key: value"])
assert result.exit_code == 0
assert re.findall("Key:Value", str(result.output))
===========changed ref 5===========
# module: tests.test_click
def test_key_value_min_rarity_0_1():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", "key : value"])
- result = runner.invoke(main, ["--rarity", "0:", "key : value"])
assert result.exit_code == 0
assert re.findall("Key:Value", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_key_value_min_rarity_0():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--rarity", "0:", "key:value"])
- result = runner.invoke(main, ["--rarity", "0:", "key:value"])
assert result.exit_code == 0
assert re.findall("Key:Value", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_file_arn3():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resourcetype:resource"]
- main, ["arn:partition:service:region:account-id:resourcetype:resource"]
)
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_file_arn4():
runner = CliRunner()
+ result = runner.invoke(
+ main, ["-db", "arn:aws:s3:::my_corporate_bucket/Development/*"]
- result = runner.invoke(main, ["arn:aws:s3:::my_corporate_bucket/Development/*"])
+ )
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_file_arn2():
runner = CliRunner()
result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resourcetype/resource"]
- main, ["arn:partition:service:region:account-id:resourcetype/resource"]
)
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 10===========
# module: tests.test_click
def test_file_s3_3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/directory/"])
- result = runner.invoke(main, ["s3://bucket/path/directory/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 11===========
# module: tests.test_click
def test_file_s3_2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/key"])
- result = runner.invoke(main, ["s3://bucket/path/key"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 12===========
# module: tests.test_click
def test_file_arn():
runner = CliRunner()
+ result = runner.invoke(
+ main, ["-db", "arn:partition:service:region:account-id:resource"]
- result = runner.invoke(main, ["arn:partition:service:region:account-id:resource"])
+ )
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
===========changed ref 13===========
# module: tests.test_click
def test_file_s3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "http://s3.amazonaws.com/bucket/"])
- result = runner.invoke(main, ["http://s3.amazonaws.com/bucket/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
|
pywhat.printer/Printing.pretty_print
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
# module: pywhat.printer
class Printing:
+ def pretty_print(self, text: dict, text_input, print_tags=False):
- def pretty_print(self, text: dict, text_input):
<0> to_out = ""
<1>
<2> if text["File Signatures"]:
<3> for key, value in text["File Signatures"].items():
<4> if value:
<5> to_out += "\n"
<6> to_out += f"[bold #D7Afff]File Identified[/bold #D7Afff]: [bold]{key}[/bold] with Magic Numbers {value['ISO 8859-1']}."
<7> to_out += f"\n[bold #D7Afff]File Description: [/bold #D7Afff] {value['Description']}."
<8> to_out += "\n\n"
<9>
<10> if text["Regexes"]:
<11> to_out += "\n[bold #D7Afff]Possible Identification[/bold #D7Afff]\n"
<12> table = Table(
<13> show_header=True, header_style="bold #D7Afff", show_lines=True
<14> )
<15> table.add_column("Matched Text", overflow="fold")
<16> table.add_column("Identified as", overflow="fold")
<17> table.add_column("Description", overflow="fold")
<18>
<19> if self._check_if_directory(text_input):
<20> # if input is a folder, add a filename column
<21> table.add_column("File", overflow="fold")
<22>
<23> # Check if there are any bug bounties with exploits
<24> # in the regex
<25> self._check_if_exploit_in_json(text)
<26> if self.bug_bounty_mode:
<27> table.add_column("Exploit", overflow="fold")
<28>
<29> for key, value in text["Regexes"].items():
<30> for i in value:
<31> matched = i["Matched"]
<32> name = i["Regex Pattern"]["Name"]
<33> description = None</s>
|
===========below chunk 0===========
# module: pywhat.printer
class Printing:
+ def pretty_print(self, text: dict, text_input, print_tags=False):
- def pretty_print(self, text: dict, text_input):
# offset: 1
exploit = None
if "URL" in i["Regex Pattern"] and i["Regex Pattern"]["URL"]:
description = (
"Click here to analyse in the browser\n"
+ i["Regex Pattern"]["URL"]
+ matched.replace(" ", "")
)
if i["Regex Pattern"]["Description"]:
if description:
description = (
description + "\n" + i["Regex Pattern"]["Description"]
)
else:
description = i["Regex Pattern"]["Description"]
if (
"Exploit" in i["Regex Pattern"]
and i["Regex Pattern"]["Exploit"]
):
exploit = i["Regex Pattern"]["Exploit"]
if not description:
description = "None"
# FIXME this is quite messy
if self.bug_bounty_mode:
if self._check_if_directory(text_input):
table.add_row(
matched,
name,
description,
filename,
exploit,
)
else:
table.add_row(
matched,
name,
description,
exploit,
)
elif self._check_if_directory(text_input):
table.add_row(
matched,
name,
description,
filename,
)
else:
table.add_row(
matched,
name,
description,
)
self.console.print(to_out.strip(), table)
elif not self.bug_bounty_mode:
self.console.print((to_out + "\nNothing found!").lstrip())
===========unchanged ref 0===========
at: pywhat.printer.Printing
_check_if_exploit_in_json(text: dict) -> bool
_check_if_directory(text_input)
at: pywhat.printer.Printing.__init__
self.bug_bounty_mode = False
at: pywhat.printer.Printing._check_if_exploit_in_json
self.bug_bounty_mode = True
===========changed ref 0===========
# module: tests.test_click
+
+
+ def test_print_tags():
+ runner = CliRunner()
+ result = runner.invoke(main, ["-db", "-pt", "thm{2}"])
+ assert result.exit_code == 0
+ assert "Tags: CTF Flag" in result.output
+
===========changed ref 1===========
# module: tests.test_click
+
+
+ def test_format5():
+ runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--format", r"%e", "thm{2}"])
+ assert result.exit_code == 0
+ assert len(result.output) == 0
+
===========changed ref 2===========
# module: tests.test_click
def test_nothing_found():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", ""])
- result = runner.invoke(main, [""])
assert result.exit_code == 0
assert "Nothing found!" in result.output
===========changed ref 3===========
# module: tests.test_click
+
+
+ def test_print_tags2():
+ runner = CliRunner()
+ result = runner.invoke(
+ main, ["-db", "--print-tags", "--format", "pretty", "thm{2}"]
+ )
+ assert result.exit_code == 0
+ assert "Tags: CTF Flag" in result.output
+
===========changed ref 4===========
# module: tests.test_click
def test_hello_world():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "THM{this is a flag}"])
- result = runner.invoke(main, ["THM{this is a flag}"])
assert result.exit_code == 0
assert "THM{" in result.output
===========changed ref 5===========
# module: tests.test_click
def test_file_fixture_date_of_birth():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Date of Birth", str(result.output))
===========changed ref 6===========
# module: tests.test_click
def test_file_fixture_turkish_id_number():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "fixtures/file"])
- result = runner.invoke(main, ["fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish Identification Number", str(result.output))
===========changed ref 7===========
# module: tests.test_click
def test_file_cors():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "Access-Control-Allow: *"])
- result = runner.invoke(main, ["Access-Control-Allow: *"])
assert result.exit_code == 0
assert re.findall("Access", str(result.output))
===========changed ref 8===========
# module: tests.test_click
def test_file_fixture_email2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "[email protected]"])
- result = runner.invoke(main, ["[email protected]"])
assert result.exit_code == 0
assert re.findall("Email", str(result.output))
===========changed ref 9===========
# module: tests.test_click
def test_json_printing2():
"""Test for empty json return"""
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "", "--json"])
- result = runner.invoke(main, ["", "--json"])
assert result.output.strip("\n") == '{"File Signatures": null, "Regexes": null}'
===========changed ref 10===========
# module: tests.test_click
def test_file_s3_3():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/directory/"])
- result = runner.invoke(main, ["s3://bucket/path/directory/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 11===========
# module: tests.test_click
def test_file_s3_2():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "s3://bucket/path/key"])
- result = runner.invoke(main, ["s3://bucket/path/key"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))
===========changed ref 12===========
# module: tests.test_click
def test_file_fixture_ip4_shodan():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", "118.103.238.230"])
- result = runner.invoke(main, ["118.103.238.230"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))
|
|
pywhat.printer/Printing.print_raw
|
Modified
|
bee-san~pyWhat
|
295d59b20cb647c06a4fcdda350a61dc2d41fe1e
|
Merge branch 'main' into improve-printing
|
# module: pywhat.printer
class Printing:
+ def print_raw(self, text: dict, text_input, print_tags=False):
- def print_raw(self, text: dict, text_input) -> str:
<0> output_str = ""
<1>
<2> if text["File Signatures"] and text["Regexes"]:
<3> for key, value in text["File Signatures"].items():
<4> if value:
<5> output_str += "\n"
<6> output_str += f"[bold #D7Afff]File Identified[/bold #D7Afff]: [bold]{key}[/bold] with Magic Numbers {value['ISO 8859-1']}."
<7> output_str += f"\n[bold #D7Afff]File Description:[/bold #D7Afff] {value['Description']}."
<8> output_str += "\n"
<9>
<10> if text["Regexes"]:
<11> for key, value in text["Regexes"].items():
<12> for i in value:
<13> description = None
<14> matched = i["Matched"]
<15> if self._check_if_directory(text_input):
<16> output_str += f"[bold #D7Afff]File: {key}[/bold #D7Afff]\n"
<17> output_str += (
<18> "[bold #D7Afff]Matched on: [/bold #D7Afff]" + i["Matched"]
<19> )
<20> output_str += (
<21> "\n[bold #D7Afff]Name: [/bold #D7Afff]"
<22> + i["Regex Pattern"]["Name"]
<23> )
<24>
<25> link = None
<26> if "URL" in i["Regex Pattern"] and i["Regex Pattern"]["URL"]:
<27> link = (
<28> "\n[bold #D7Afff]Link: [/bold #D7Afff] "
<29> + i["Regex Pattern"]["URL"]
<30> + matched.replace(" ", "")
<31> )
<32>
<33> if link:
<34> output_str += link
<35> </s>
|
===========below chunk 0===========
# module: pywhat.printer
class Printing:
+ def print_raw(self, text: dict, text_input, print_tags=False):
- def print_raw(self, text: dict, text_input) -> str:
# offset: 1
description = (
"\n[bold #D7Afff]Description: [/bold #D7Afff]"
+ i["Regex Pattern"]["Description"]
)
if description:
output_str += description
if (
"Exploit" in i["Regex Pattern"]
and i["Regex Pattern"]["Exploit"]
):
output_str += (
"\n[bold #D7Afff]Exploit: [/bold #D7Afff]"
+ i["Regex Pattern"]["Exploit"]
)
output_str += "\n\n"
if output_str == "" and not self.bug_bounty_mode:
self.console.print("Nothing found!")
if output_str.strip():
self.console.print(output_str.rstrip())
return output_str
===========unchanged ref 0===========
at: json
dumps(obj: Any, *, skipkeys: bool=..., ensure_ascii: bool=..., check_circular: bool=..., allow_nan: bool=..., cls: Optional[Type[JSONEncoder]]=..., indent: Union[None, int, str]=..., separators: Optional[Tuple[str, str]]=..., default: Optional[Callable[[Any], Any]]=..., sort_keys: bool=..., **kwds: Any) -> str
at: pywhat.printer.Printing
_check_if_directory(text_input)
at: pywhat.printer.Printing.__init__
self.console = Console(highlight=False)
===========changed ref 0===========
# module: pywhat.printer
class Printing:
+ def pretty_print(self, text: dict, text_input, print_tags=False):
- def pretty_print(self, text: dict, text_input):
to_out = ""
if text["File Signatures"]:
for key, value in text["File Signatures"].items():
if value:
to_out += "\n"
to_out += f"[bold #D7Afff]File Identified[/bold #D7Afff]: [bold]{key}[/bold] with Magic Numbers {value['ISO 8859-1']}."
to_out += f"\n[bold #D7Afff]File Description: [/bold #D7Afff] {value['Description']}."
to_out += "\n\n"
if text["Regexes"]:
to_out += "\n[bold #D7Afff]Possible Identification[/bold #D7Afff]\n"
table = Table(
show_header=True, header_style="bold #D7Afff", show_lines=True
)
table.add_column("Matched Text", overflow="fold")
table.add_column("Identified as", overflow="fold")
table.add_column("Description", overflow="fold")
if self._check_if_directory(text_input):
# if input is a folder, add a filename column
table.add_column("File", overflow="fold")
# Check if there are any bug bounties with exploits
# in the regex
self._check_if_exploit_in_json(text)
if self.bug_bounty_mode:
table.add_column("Exploit", overflow="fold")
for key, value in text["Regexes"].items():
for i in value:
matched = i["Matched"]
name = i["Regex Pattern"]["Name"]
description = None
filename = key
exploit = None
if "URL" in i["Regex Pattern"] and i["Regex Pattern"]["URL"]</s>
===========changed ref 1===========
# module: pywhat.printer
class Printing:
+ def pretty_print(self, text: dict, text_input, print_tags=False):
- def pretty_print(self, text: dict, text_input):
# offset: 1
<s> key
exploit = None
if "URL" in i["Regex Pattern"] and i["Regex Pattern"]["URL"]:
description = (
"Click here to analyse in the browser\n"
+ i["Regex Pattern"]["URL"]
+ matched.replace(" ", "")
)
if i["Regex Pattern"]["Description"]:
if description:
description = (
description + "\n" + i["Regex Pattern"]["Description"]
)
else:
description = i["Regex Pattern"]["Description"]
if (
"Exploit" in i["Regex Pattern"]
and i["Regex Pattern"]["Exploit"]
):
exploit = i["Regex Pattern"]["Exploit"]
+ if print_tags:
+ tags = f"Tags: {', '.join(i['Regex Pattern']['Tags'])}"
+ if description is None:
+ description = tags
+ else:
+ description += "\n" + tags
+
+ if description is None:
- if not description:
description = "None"
# FIXME this is quite messy
if self.bug_bounty_mode:
if self._check_if_directory(text_input):
table.add_row(
matched,
name,
description,
filename,
exploit,
)
else:
table.add_row(
matched,
name,
description,
exploit,
)
elif self._check_if_directory(text_input):
table.add_row(
matched,
name,
description,
filename,
)
else</s>
===========changed ref 2===========
# module: pywhat.printer
class Printing:
+ def pretty_print(self, text: dict, text_input, print_tags=False):
- def pretty_print(self, text: dict, text_input):
# offset: 2
<s> table.add_row(
matched,
name,
description,
)
self.console.print(to_out.strip(), table)
elif not self.bug_bounty_mode:
self.console.print((to_out + "\nNothing found!").lstrip())
===========changed ref 3===========
# module: tests.test_click
+
+
+ def test_print_tags():
+ runner = CliRunner()
+ result = runner.invoke(main, ["-db", "-pt", "thm{2}"])
+ assert result.exit_code == 0
+ assert "Tags: CTF Flag" in result.output
+
===========changed ref 4===========
# module: tests.test_click
+
+
+ def test_format5():
+ runner = CliRunner()
+ result = runner.invoke(main, ["-db", "--format", r"%e", "thm{2}"])
+ assert result.exit_code == 0
+ assert len(result.output) == 0
+
===========changed ref 5===========
# module: tests.test_click
def test_nothing_found():
runner = CliRunner()
+ result = runner.invoke(main, ["-db", ""])
- result = runner.invoke(main, [""])
assert result.exit_code == 0
assert "Nothing found!" in result.output
===========changed ref 6===========
# module: tests.test_click
+
+
+ def test_print_tags2():
+ runner = CliRunner()
+ result = runner.invoke(
+ main, ["-db", "--print-tags", "--format", "pretty", "thm{2}"]
+ )
+ assert result.exit_code == 0
+ assert "Tags: CTF Flag" in result.output
+
|
|
tests.test_regex_formatting/test_name_capitalization
|
Modified
|
bee-san~pyWhat
|
2589780ad1a943d277aee5a6bc31a86c57bc033d
|
Add mount commands and fstab entries with clear credentials (#210)
|
<13>:<add> "Please capitalize the first letter of each word."
<del> "Please capitalize every the first letter of each word."
|
# module: tests.test_regex_formatting
def test_name_capitalization():
<0> for entry in database:
<1> entry_name = entry["Name"]
<2> for word in entry_name.split():
<3> upper_and_num_count = sum(1 for c in word if c.isupper() or c.isnumeric())
<4> if upper_and_num_count > 0:
<5> continue
<6> cleaned_word = word.translate({ord(c): None for c in "(),."})
<7> if cleaned_word in ["a", "of", "etc"]:
<8> continue
<9>
<10> assert word.title() == word, (
<11> f'Wrong capitalization in regex name: "{entry_name}"\n'
<12> f'Expected: "{entry_name.title()}"\n'
<13> "Please capitalize every the first letter of each word."
<14> )
<15>
|
===========unchanged ref 0===========
at: tests.test_regex_formatting
database = load_regexes()
|
tests.test_regex_identifier/test_regex_successfully_parses
|
Modified
|
bee-san~pyWhat
|
dd077aa910d89f5698b5ac84549b7be5cb806237
|
refactor tests/test_regex_identifier.py (#202)
|
<0>:<add> regexes = r.distribution.get_regexes()
<add> assert type(regexes) == list
<add> assert len(regexes) != 0
<add> assert all([type(regex) == dict for regex in regexes])
<del> assert "Name" in r.distribution.get_regexes()[0]
|
# module: tests.test_regex_identifier
def test_regex_successfully_parses():
<0> assert "Name" in r.distribution.get_regexes()[0]
<1>
|
===========unchanged ref 0===========
at: pywhat.regex_identifier.RegexIdentifier
check(text, dist: Optional[Distribution]=None, *, boundaryless: Optional[Filter]=None)
at: tests.test_regex_identifier
r = regex_identifier.RegexIdentifier()
dist = Distribution(Filter({"MinRarity": 0.0}))
===========changed ref 0===========
# module: tests.test_regex_identifier
- def _assert_match_exploit_first_item(search, res):
- assert search in res[0]["Regex Pattern"]["Exploit"]
-
===========changed ref 1===========
# module: tests.test_regex_identifier
- def _assert_match_first_item(name, res):
- assert name in res[0]["Regex Pattern"]["Name"]
-
===========changed ref 2===========
# module: tests.test_regex_identifier
+ def regex_valid_match(name: str, match: str) -> bool:
+ return any(
+ name in matched["Regex Pattern"]["Name"]
+ for matched in r.check([match], dist=dist)
+ )
+
===========changed ref 3===========
# module: tests.test_regex_identifier
database = load_regexes()
r = regex_identifier.RegexIdentifier()
- filter1 = Filter({"MinRarity": 0.0})
- d = Distribution(filter1)
- r_rarity_0 = regex_identifier.RegexIdentifier()
+ dist = Distribution(Filter({"MinRarity": 0.0}))
|
tests.test_regex_identifier/test_international_url
|
Modified
|
bee-san~pyWhat
|
dd077aa910d89f5698b5ac84549b7be5cb806237
|
refactor tests/test_regex_identifier.py (#202)
|
<0>:<add> assert regex_valid_match(
<add> "Uniform Resource Locator (URL)", r.check(["http://папироска.рф"])
<add> )
<del> res = r.check(["http://папироска.рф"])
<1>:<del> _assert_match_first_item("Uniform Resource Locator (URL)", res)
|
# module: tests.test_regex_identifier
@pytest.mark.skip(
reason="Fails because not a valid TLD. If presented in punycode, it works."
)
def test_international_url():
<0> res = r.check(["http://папироска.рф"])
<1> _assert_match_first_item("Uniform Resource Locator (URL)", res)
<2>
|
===========changed ref 0===========
# module: tests.test_regex_identifier
- def test_mac6():
- res = r.check(["00:00:0G:00:00:00"])
- assert (
- not res
- or res[0]["Regex Pattern"]["Name"]
- != "EUI-48 Identifier (Ethernet, WiFi, Bluetooth, etc)"
- )
-
===========changed ref 1===========
# module: tests.test_regex_identifier
- def test_mac5():
- res = r.check(["00:00-00-00-00-00"])
- assert (
- not res
- or res[0]["Regex Pattern"]["Name"]
- != "EUI-48 Identifier (Ethernet, WiFi, Bluetooth, etc)"
- )
-
===========changed ref 2===========
# module: tests.test_regex_identifier
- def test_mac4():
- res = r.check(["00-00-00-00.00-00"])
- assert (
- not res
- or res[0]["Regex Pattern"]["Name"]
- != "EUI-48 Identifier (Ethernet, WiFi, Bluetooth, etc)"
- )
-
===========changed ref 3===========
# module: tests.test_regex_identifier
- def test_ip4():
- res = r.check(["[2001:db8::1]:8080"])
- assert "[2001:db8::1]:8080" in res[0]["Matched"]
-
===========changed ref 4===========
# module: tests.test_regex_identifier
- def test_ip2():
- res = r.check(["192.0.2.235:80"])
- assert "192.0.2.235:80" in res[0]["Matched"]
-
===========changed ref 5===========
# module: tests.test_regex_identifier
- def test_ip_not_url():
- res = r.check(["http://10.1.1.1"])
- assert "Uniform Resource Locator (URL)" not in res[0]
-
===========changed ref 6===========
<s>",
+ ),
+ (
+ "xoxb-51465443183-hgvhXVd2ISC2x7gaoRWBOUdQ",
+ "https://slack.com/api/auth.test?token=xoxb-51465443183-hgvhXVd2ISC2x7gaoRWBOUdQ",
+ ),
+ ],
+ )
+ def test_match_exploit(match: str, exploit: str):
+ assert exploit in r.check([match])[0]["Regex Pattern"]["Exploit"]
+
===========changed ref 7===========
# module: tests.test_regex_identifier
- def test_ip3():
- res = r.check(["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
- _assert_match_first_item("Internet Protocol (IP) Address Version 6", res)
-
===========changed ref 8===========
<s>09010000000004", "UNION NATIONAL BANK"),
+ ("5409 0100 0000 0004", "UNION NATIONAL BANK"),
+ # Phone Number
+ ("+1-202-555-0156", "United States"),
+ ("+662025550156", "Thailand"),
+ ("+356 202 555 0156", "Malta"),
+ ],
+ )
+ def test_match_description(match: str, description: str):
+ assert description in r.check([match])[0]["Regex Pattern"]["Description"]
+
===========changed ref 9===========
# module: tests.test_regex_identifier
- def test_lat_long6():
- res = r.check(["40.741895,-73.989308"])
- _assert_match_first_item("Latitude & Longitude Coordinates", res)
-
===========changed ref 10===========
# module: tests.test_regex_identifier
- def test_mac3():
- res = r.check(["0000.0000.0000"])
- assert (
- res
- and "0000.0000.0000" in res[0]["Matched"]
- and res[0]["Regex Pattern"]["Name"]
- == "EUI-48 Identifier (Ethernet, WiFi, Bluetooth, etc)"
- and "Xerox Corp" in res[0]["Regex Pattern"]["Description"]
- )
-
===========changed ref 11===========
# module: tests.test_regex_identifier
+ @pytest.mark.parametrize(
+ "name,match",
+ [
+ (regex["Name"], match)
+ for regex in database
+ for match in regex.get("Examples", {}).get("Invalid", [])
+ ],
+ )
+ def test_regex_invalid_match(name: str, match: str):
+ assert not regex_valid_match(name, match)
+
===========changed ref 12===========
# module: tests.test_regex_identifier
- def test_lat_long5():
- res = r.check(["41\u00B024'12.2\" N 2\u00B010'26.5\" E"])
- _assert_match_first_item("Latitude & Longitude Coordinates", res)
-
===========changed ref 13===========
# module: tests.test_regex_identifier
- def test_lat_long3():
- res = r.check(["77\u00B0 30' 29.9988\" N"])
- _assert_match_first_item("Latitude & Longitude Coordinates", res)
-
===========changed ref 14===========
# module: tests.test_regex_identifier
- def test_lat_long2():
- res = r.check(["53.76297,-1.9388732"])
- _assert_match_first_item("Latitude & Longitude Coordinates", res)
-
===========changed ref 15===========
# module: tests.test_regex_identifier
- def test_invalid_tld():
- res = r.check(["tryhackme.comm"])
- assert "Uniform Resource Locator (URL)" not in res
-
===========changed ref 16===========
# module: tests.test_regex_identifier
- def test_mac2():
- res = r.check(["00-00-00-00-00-00"])
- assert (
- res
- and "00-00-00-00-00-00" in res[0]["Matched"]
- and res[0]["Regex Pattern"]["Name"]
- == "EUI-48 Identifier (Ethernet, WiFi, Bluetooth, etc)"
- and "Xerox Corp" in res[0]["Regex Pattern"]["Description"]
- )
-
===========changed ref 17===========
# module: tests.test_regex_identifier
+ @pytest.mark.parametrize(
+ "name,match",
+ [
+ (regex["Name"], match)
+ for regex in database
+ for match in regex.get("Examples", {}).get("Valid", [])
+ ],
+ )
+ def test_regex_valid_match(name: str, match: str):
+ assert regex_valid_match(name, match)
+
===========changed ref 18===========
# module: tests.test_regex_identifier
- def test_lat_long():
- res = r.check(["52.6169586, -1.9779857"])
- _assert_match_first_item("Latitude & Longitude Coordinates", res)
-
===========changed ref 19===========
# module: tests.test_regex_identifier
- def test_https():
- res = r.check(["hTTPs://tryhackme.com"])
- _assert_match_first_item("Uniform Resource Locator (URL)", res)
-
===========changed ref 20===========
# module: tests.test_regex_identifier
- def test_mac():
- res = r.check(["00:00:00:00:00:00"])
- assert (
- res
- and "00:00:00:00:00:00" in res[0]["Matched"]
- and res[0]["Regex Pattern"]["Name"]
- == "EUI-48 Identifier (Ethernet, WiFi, Bluetooth, etc)"
- and "Xerox Corp" in res[0]["Regex Pattern"]["Description"]
- )
-
|
pywhat.filter/Filter.__contains__
|
Modified
|
bee-san~pyWhat
|
2f4e0ccb1d6b5508dc6ba61e40fb3dfe3b413ba0
|
Merge branch 'main' into flake8
|
<6>:<add> except KeyError:
<del> except:
|
# module: pywhat.filter
class Filter(Mapping):
def __contains__(self, item):
<0> try:
<1> return (
<2> self["MinRarity"] <= item["Rarity"] <= self["MaxRarity"]
<3> and set(item["Tags"]) & self["Tags"]
<4> and not set(item["Tags"]) & self["ExcludeTags"]
<5> )
<6> except:
<7> return False
<8>
|
===========unchanged ref 0===========
at: typing.Mapping
__contains__(self, o: object) -> bool
===========changed ref 0===========
# module: pywhat.helper
class Keys(Enum):
+ def MATCHED(match):
+ return match["Matched"]
+
===========changed ref 1===========
# module: pywhat.helper
class Keys(Enum):
+ def NAME(match):
+ return match["Regex Pattern"]["Name"]
+
===========changed ref 2===========
# module: pywhat.helper
class Keys(Enum):
+ def RARITY(match):
+ return match["Regex Pattern"]["Rarity"]
+
===========changed ref 3===========
# module: pywhat.helper
class Keys(Enum):
- NAME = lambda match: match["Regex Pattern"]["Name"]
- RARITY = lambda match: match["Regex Pattern"]["Rarity"]
- MATCHED = lambda match: match["Matched"]
NONE = auto()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.