From d07df7b92c1ebf464428a8fce02499c3fcb21ed4 Mon Sep 17 00:00:00 2001 From: theodosisathanasakis Date: Sat, 5 Jan 2019 13:19:43 +0200 Subject: [PATCH 01/25] Supports Debian/Ubuntu, Arch, Fedora,CentOS/RHEL and OpenSUSE based distos --- install_packages.sh | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) mode change 100644 => 100755 install_packages.sh diff --git a/install_packages.sh b/install_packages.sh old mode 100644 new mode 100755 index cd6eb25d..4afdb661 --- a/install_packages.sh +++ b/install_packages.sh @@ -1,11 +1,39 @@ #!/bin/bash -# install python3 if not exist -sudo apt-get install python3 +# Determine which is the default package manager +APT=$(which apt) +PACMAN=$(which pacman) +DNF=$(which dnf) +YUM=$(which yum) +ZYPPER=$(which zypper) + +# install python3 and pip3 if not exist +if [ ${#APT} -gt 0 ]; then + sudo apt-get install python3 + sudo apt-get install python3-pip +elif [ ${#PACMAN} -gt 0 ]; then + echo bla + sudo pacman -S python3 + sudo pacman -S python3-pip +elif [ ${#DNF} -gt 0 ]; then + sudo dnf install python3 + sudo dnf install python3-pip +elif [ ${#YUM} -gt 0 ]; then + sudo yum install python3 + sudo yum install python3-pip +elif [ ${#ZYPPER} -gt 0 ]; then + sudo zypper install python3 + sudo zypper install python3-pip +else + echo "Unknown packge manager. Download one of the following:" + echo " apt, pacman, dnf, yum or zypper" + echo "" + echo "or use README.md for instructions." + exit 1 +fi + # install the all the necessery packages and requirements -sudo apt-get install python3-pip sudo pip3 install --upgrade setuptools sudo pip3 install -r requirements.txt - From 36a61ffd5748fb907040440eadaaaeb9de7091a1 Mon Sep 17 00:00:00 2001 From: theodosisathanasakis Date: Sat, 5 Jan 2019 13:22:45 +0200 Subject: [PATCH 02/25] Supports Debian/Ubuntu, Arch, Fedora, CentOS/RHEL and OpenSUSE based distos --- install_packages.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/install_packages.sh b/install_packages.sh index 4afdb661..1acb29d8 100755 --- a/install_packages.sh +++ b/install_packages.sh @@ -12,7 +12,6 @@ if [ ${#APT} -gt 0 ]; then sudo apt-get install python3 sudo apt-get install python3-pip elif [ ${#PACMAN} -gt 0 ]; then - echo bla sudo pacman -S python3 sudo pacman -S python3-pip elif [ ${#DNF} -gt 0 ]; then From 4e037f6397ce719ade9b6c0e97a52e293c536c3e Mon Sep 17 00:00:00 2001 From: theodosisathanasakis Date: Sat, 5 Jan 2019 16:40:33 +0200 Subject: [PATCH 03/25] packge to package --- install_packages.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_packages.sh b/install_packages.sh index 1acb29d8..cbcb5638 100755 --- a/install_packages.sh +++ b/install_packages.sh @@ -24,7 +24,7 @@ elif [ ${#ZYPPER} -gt 0 ]; then sudo zypper install python3 sudo zypper install python3-pip else - echo "Unknown packge manager. Download one of the following:" + echo "Unknown package manager. Download one of the following:" echo " apt, pacman, dnf, yum or zypper" echo "" echo "or use README.md for instructions." From d113991f4503919cfadde3fac022cc46db1d9d82 Mon Sep 17 00:00:00 2001 From: theodosisathanasakis Date: Sat, 5 Jan 2019 22:23:59 +0200 Subject: [PATCH 04/25] Choice between globally or locally download of dependencies --- install_packages.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/install_packages.sh b/install_packages.sh index cbcb5638..e444571f 100755 --- a/install_packages.sh +++ b/install_packages.sh @@ -31,8 +31,21 @@ else exit 1 fi - + # install the all the necessery packages and requirements -sudo pip3 install --upgrade setuptools -sudo pip3 install -r requirements.txt +echo '' +echo '' +while true; do + echo 'Do you want dependencies to be installed globally (or locally) [Y/n]?' + read ans + if [[ ${#ans} -eq 0 || $ans = "Y" || $ans = "y" ]]; then + sudo pip3 install --upgrade setuptools + sudo pip3 install -r requirements.txt + elif [[ $ans = "N" || $ans = "n" ]]; then + sudo pip3 install --user --upgrade setuptools + sudo pip3 install --user -r requirements.txt + fi + + [[ ${#ans} -eq 0 || $ans = "Y" || $ans = "y" || $ans = "N" || $ans = "n" ]] && break; +done From 33a65c57e1a4d221f3f4d151c5342b8aaac67e7f Mon Sep 17 00:00:00 2001 From: HATI <37483725+HA71@users.noreply.github.com> Date: Wed, 16 Jan 2019 11:16:50 +0100 Subject: [PATCH 05/25] Update sites.md --- sites.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sites.md b/sites.md index 3f60d044..72df61c9 100644 --- a/sites.md +++ b/sites.md @@ -115,5 +115,16 @@ 114. [Mastodon](https://mstdn.io/) 115. [Telegram](https://t.me/) 116. [TradingView] (https://www.tradingview.com/) -117. [Kaggle] (https://www.kaggle.com/) -118. [Itch.io] (https://itch.io/) \ No newline at end of file +117. [Kaggle](https://www.kaggle.com/) +118. [Itch.io](https://itch.io/) +119. [Basecamp](https://basecamp.com/) +120. [ProductHunt](https://www.producthunt.com/) +121. [Younow](https://www.younow.com/) +122. [Smashcast](https://www.smashcast.tv/) +123. [AskFM](https://ask.fm/) +124. [KanoWorld](https://world.kano.me/) +125. [EyeEm](https://www.eyeem.com/) +126. [Wikia](http://www.wikia.com/) +127. [CreativeMarket](https://creativemarket.com/) +128. [Venmo](https://venmo.com/) +129. [HubPages](https://hubpages.com/) From b82a692886554a666bb25ade90fa98ac4ea1f5d1 Mon Sep 17 00:00:00 2001 From: HATI <37483725+HA71@users.noreply.github.com> Date: Wed, 16 Jan 2019 11:18:55 +0100 Subject: [PATCH 06/25] Update data.json --- data.json | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/data.json b/data.json index a63b8503..7047f186 100644 --- a/data.json +++ b/data.json @@ -666,5 +666,64 @@ "url": "https://{}.itch.io/", "urlMain": "https://itch.io/", "errorType": "status_code" - } + }, + "Basecamp":{ + "url": "https://{}.basecamphq.com", + "urlMain": "https://basecamp.com/", + "errorType": "message", + "errorMsg": "The account you were looking for doesn't exist" + }, + "ProductHunt":{ + "url": "https://www.producthunt.com/@{}", + "urlMain": "https://www.producthunt.com/", + "errorType": "message", + "errorMsg": "Product Hunt is a curation of the best new products" + }, + "Younow":{ + "url": "https://www.younow.com/{}", + "urlMain": "https://www.younow.com/", + "errorType": "message", + "errorMsg": "pageTitle || 'YouNow - Broadcast Live" + }, + "Smashcast":{ + "url": "https://www.smashcast.tv/api/media/live/{}", + "urlMain": "https://www.smashcast.tv/", + "errorType": "status_code" + }, + "AskFM":{ + "url": "https://ask.fm/{}", + "urlMain": "https://ask.fm/", + "errorType": "status_code" + }, + "KanoWorld":{ + "url": "https://api.kano.me/progress/user/{}", + "urlMain": "https://world.kano.me/", + "errorType": "status_code" + }, + "EyeEm":{ + "url": "https://www.eyeem.com/u/{}", + "urlMain": "https://www.eyeem.com/", + "errorType": "status_code" + }, + "Wikia":{ + "url": "https://wikia.com/wiki/User:{}", + "urlMain": "http://www.wikia.com/", + "errorType": "message", + "errorMsg": "does not exist" + }, + "CreativeMarket":{ + "url": "https://creativemarket.com/{}", + "urlMain": "https://creativemarket.com/", + "errorType": "status_code" + }, + "Venmo":{ + "url": "https://venmo.com/{}", + "urlMain": "https://venmo.com/", + "errorType": "status_code" + }, + "HubPages":{ + "url": "https://hubpages.com/@{}", + "urlMain": "https://hubpages.com/", + "errorType": "status_code" + } } From df6c323e4af62e4b8a751d4d0e1fc3fdad7fd26e Mon Sep 17 00:00:00 2001 From: HATI <37483725+HA71@users.noreply.github.com> Date: Wed, 16 Jan 2019 17:15:46 +0100 Subject: [PATCH 07/25] Update sites.md --- sites.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sites.md b/sites.md index 72df61c9..6bcc341b 100644 --- a/sites.md +++ b/sites.md @@ -128,3 +128,6 @@ 127. [CreativeMarket](https://creativemarket.com/) 128. [Venmo](https://venmo.com/) 129. [HubPages](https://hubpages.com/) +130. [StreamMe](https://www.stream.me/) +131. [Ello](https://ello.co/) +132. [Kik](http://kik.me/) From 2bb8b4876c848095095dc36e46cbd09d12d44b1a Mon Sep 17 00:00:00 2001 From: HATI <37483725+HA71@users.noreply.github.com> Date: Wed, 16 Jan 2019 17:16:31 +0100 Subject: [PATCH 08/25] Update data.json --- data.json | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/data.json b/data.json index 7047f186..7cff523b 100644 --- a/data.json +++ b/data.json @@ -720,10 +720,27 @@ "url": "https://venmo.com/{}", "urlMain": "https://venmo.com/", "errorType": "status_code" - }, + }, "HubPages":{ "url": "https://hubpages.com/@{}", "urlMain": "https://hubpages.com/", "errorType": "status_code" - } + }, + "StreamMe":{ + "url": "https://www.stream.me/{}", + "urlMain": "https://www.stream.me/", + "errorType": "status_code" + }, + "Ello":{ + "url": "https://ello.co/{}", + "urlMain": "https://ello.co/", + "errorType": "message", + "errorMsg": "If all else fails you can try checking out our" + }, + "Kik":{ + "url": "https://ws2.kik.com/user/{}", + "urlMain": "http://kik.me/", + "errorType": "message", + "errorMsg": "The page you requested was not found" + } } From 2e0bface8abf91010d4c08cf63842269b8e4f322 Mon Sep 17 00:00:00 2001 From: theodosisathanasakis Date: Wed, 16 Jan 2019 18:18:10 +0200 Subject: [PATCH 09/25] install python3 and python3-pip if not exist --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 94aa6391..0b129e46 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ $ git clone https://github.com/TheYahya/sherlock.git # change the working directory to sherlock $ cd sherlock +# install python3 and python3-pip if not exist + # install the requirements $ pip3 install -r requirements.txt ``` From 2ce0e01afaa0ff3217e35516419a2ebc909ca02f Mon Sep 17 00:00:00 2001 From: JakeConnors376W <46732192+JakeConnors376W@users.noreply.github.com> Date: Wed, 16 Jan 2019 16:11:57 -0800 Subject: [PATCH 10/25] Update README.md Make more concise --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0b129e46..f765e31f 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ Once the image is built sherlock can be invoked by running the following: docker run --rm mysherlock-image user123 ``` -The ```--rm``` flag is optional. It removes the container filesystem after running so you do not have a bunch of leftover container filesystem cruft. See https://docs.docker.com/engine/reference/run/#clean-up---rm +The optional ```--rm``` flag removes the container filesystem on completion to prevent cruft build-up. See https://docs.docker.com/engine/reference/run/#clean-up---rm One caveat is the text file that is created will only exist in the container so you will not be able to get at that. From 78818559b5af7092b19cfcd177ee632f33a206bd Mon Sep 17 00:00:00 2001 From: Jus de Patate Date: Sat, 19 Jan 2019 11:40:20 +0100 Subject: [PATCH 11/25] Add Star Citizen and EVE Online --- data.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/data.json b/data.json index a63b8503..624bda04 100644 --- a/data.json +++ b/data.json @@ -666,5 +666,17 @@ "url": "https://{}.itch.io/", "urlMain": "https://itch.io/", "errorType": "status_code" + }, + "Star Citizen": { + "url": "https://robertsspaceindustries.com/citizens/{}", + "urlMain": "https://robertsspaceindustries.com/", + "errorType": "status_code" + }, + "EVE Online": { + "url": "https://evewho.com/search/{}", + "urlMain": "https://eveonline.com", + "errorType": "message", + "errorMsg": "No results found with your search..." } } + From 82bd0429609c4cbcad004e4363876141f0e5f953 Mon Sep 17 00:00:00 2001 From: HATI <37483725+HA71@users.noreply.github.com> Date: Sat, 19 Jan 2019 14:45:51 +0100 Subject: [PATCH 12/25] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 94aa6391..466ab314 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Sherlock -> Find usernames across [social networks](https://github.com/sdushantha/sherlock/blob/master/sites.md) +> Find usernames across [social networks](https://github.com/HA71/sherlock/blob/master/sites.md)

From d24387e30a97ebc5ff14313dca6621bc183f2d70 Mon Sep 17 00:00:00 2001 From: HATI <37483725+HA71@users.noreply.github.com> Date: Sat, 19 Jan 2019 14:46:39 +0100 Subject: [PATCH 13/25] Update sites.md --- sites.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sites.md b/sites.md index 6bcc341b..3e114b3f 100644 --- a/sites.md +++ b/sites.md @@ -114,7 +114,7 @@ 113. [Wikipedia](https://www.wikipedia.org/) 114. [Mastodon](https://mstdn.io/) 115. [Telegram](https://t.me/) -116. [TradingView] (https://www.tradingview.com/) +116. [TradingView](https://www.tradingview.com/) 117. [Kaggle](https://www.kaggle.com/) 118. [Itch.io](https://itch.io/) 119. [Basecamp](https://basecamp.com/) From 7eeaabf17ee97245827245e770f5874355301063 Mon Sep 17 00:00:00 2001 From: Jus de Patate Date: Sat, 19 Jan 2019 16:12:12 +0100 Subject: [PATCH 14/25] Update sites.md --- sites.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sites.md b/sites.md index 3f60d044..af349ef6 100644 --- a/sites.md +++ b/sites.md @@ -116,4 +116,6 @@ 115. [Telegram](https://t.me/) 116. [TradingView] (https://www.tradingview.com/) 117. [Kaggle] (https://www.kaggle.com/) -118. [Itch.io] (https://itch.io/) \ No newline at end of file +118. [Itch.io] (https://itch.io/) +119. [EVE Online](https://eveonline.com) +120. [Star Citizen](https://robertsspaceindustries.com) From 26a4d7187550b2d6e97275819fc5c543f61cbfd5 Mon Sep 17 00:00:00 2001 From: Yahya SayadArbabi Date: Sat, 19 Jan 2019 19:20:51 +0330 Subject: [PATCH 15/25] Update readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 466ab314..59727ee7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Sherlock -> Find usernames across [social networks](https://github.com/HA71/sherlock/blob/master/sites.md) +> Find usernames across [social networks](https://github.com/theyahya/sherlock/blob/master/sites.md)

@@ -78,4 +78,4 @@ docker run theyahya/sherlock user123 ## License MIT License -Copyright (c) 2018 Siddharth Dushantha +Copyright (c) 2018 Yahya SayadArbabi From e92225aaa23231b73236cd85a0b76b4d929a6deb Mon Sep 17 00:00:00 2001 From: Yahya SayadArbabi Date: Sat, 19 Jan 2019 19:23:42 +0330 Subject: [PATCH 16/25] Update license --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 7be22094..48496518 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,5 @@ docker run theyahya/sherlock user123 ``` ## License -MIT License -Copyright (c) 2018 Yahya SayadArbabi +MIT © [Yahya SayadArbabi](https://theyahya.com) From d4e29b1327f4977c2b3e1de9900132f603c3130b Mon Sep 17 00:00:00 2001 From: Yahya SayadArbabi Date: Sat, 19 Jan 2019 19:24:02 +0330 Subject: [PATCH 17/25] bump version --- sherlock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sherlock.py b/sherlock.py index 819e057d..ee471100 100644 --- a/sherlock.py +++ b/sherlock.py @@ -23,7 +23,7 @@ from requests_futures.sessions import FuturesSession from torrequest import TorRequest module_name = "Sherlock: Find Usernames Across Social Networks" -__version__ = "0.2.6" +__version__ = "0.2.7" amount = 0 # TODO: fix tumblr From ee4cd8e14b6356e595c7d3ba4966019acec10347 Mon Sep 17 00:00:00 2001 From: "Christopher K. Hoadley" Date: Mon, 21 Jan 2019 16:30:07 -0600 Subject: [PATCH 18/25] While running tests, I was getting a ResourceWarning about an unclosed file. The result file was not being closed, so it was a valid warning. Close the file to avoid this warning. --- sherlock.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sherlock.py b/sherlock.py index ee471100..452e04ea 100644 --- a/sherlock.py +++ b/sherlock.py @@ -326,6 +326,7 @@ def sherlock(username, site_data, verbose=False, tor=False, unique_tor=False, pr Fore.WHITE + "{}").format(fname)) final_score(amount, f) + f.close() return results_total From f6860510ea09bab769ed025ca5f7512e37f5a21c Mon Sep 17 00:00:00 2001 From: "Christopher K. Hoadley" Date: Mon, 21 Jan 2019 19:26:07 -0600 Subject: [PATCH 19/25] Add basic test infrastructure using unittest. Add tests to verify the 3 mechanisms of determining that a username is *not* supported on a given site. Created SherlockBaseTest() class that provides infrastructure for the tests. TODO: It seems that devRant is not detecting users that certainly exist. TODO: While running tests, there is a ResourceWarning from an unclosed SSLSocket. This needs work. --- README.md | 22 +++++++++- tests/__init__.py | 4 ++ tests/all.py | 94 ++++++++++++++++++++++++++++++++++++++++ tests/base.py | 107 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 226 insertions(+), 1 deletion(-) create mode 100644 tests/__init__.py create mode 100644 tests/all.py create mode 100644 tests/base.py diff --git a/README.md b/README.md index 48496518..1abf5f85 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Sherlock -> Find usernames across [social networks](https://github.com/theyahya/sherlock/blob/master/sites.md) +> Find usernames across [social networks](https://github.com/theyahya/sherlock/blob/master/sites.md)

@@ -77,6 +77,26 @@ Or you can simply use "Docker Hub" to run `sherlock`: docker run theyahya/sherlock user123 ``` +## Tests +If you are contributing to Sherlock, then Thank You! + +Before creating a pull request with new development, please run the tests +to ensure that all is well. It would also be a good idea to run the tests +before starting development to distinguish problems between your +environment and the Sherlock software. + +The following is an example of the command line to run all the tests for +Sherlock. This invocation hides the progress text that Sherlock normally +outputs, and instead shows the verbose output of the tests. + +``` +% python3 -m unittest tests.all --buffer --verbose +``` + +Note that the tests are very much a work in progress. Significant work is +required to get full test coverage. But, the current tests are working +properly, and will be expanded as time goes by. + ## License MIT © [Yahya SayadArbabi](https://theyahya.com) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 00000000..944e27ce --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,4 @@ +"""Sherlock Tests + +This package contains various submodules used to run tests. +""" diff --git a/tests/all.py b/tests/all.py new file mode 100644 index 00000000..87d3b9b8 --- /dev/null +++ b/tests/all.py @@ -0,0 +1,94 @@ +"""Sherlock Tests + +This module contains various tests. +""" +from tests.base import SherlockBaseTest +import unittest + + +class SherlockDetectTests(SherlockBaseTest): + def test_detect_true(self): + """Test Username Existence Detection. + + This test ensures that the mechanism of ensuring that a Username + exists works properly. + + Keyword Arguments: + self -- This object. + + Return Value: + N/A. + Will trigger an assert if Usernames which are known to exist are + not detected. + """ + + self.username_check(['jack'], ['Twitter'], exist_check=True) + #self.username_check(['dfox'], ['devRant'], exist_check=True) + self.username_check(['blue'], ['Pinterest'], exist_check=True) + self.username_check(['kevin'], ['Instagram'], exist_check=True) + self.username_check(['zuck'], ['Facebook'], exist_check=True) + + return + + def test_detect_false_via_message(self): + """Test Username Does Not Exist (Via Message). + + This test ensures that the "message" detection mechanism of + ensuring that a Username does *not* exist works properly. + + Keyword Arguments: + self -- This object. + + Return Value: + N/A. + Will trigger an assert if detection mechanism did not work as expected. + """ + + self.username_check(['jackkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk'], + ['Instagram'], + exist_check=False + ) + + return + + def test_detect_false_via_status_code(self): + """Test Username Does Not Exist (Via Status Code). + + This test ensures that the "status code" detection mechanism of + ensuring that a Username does *not* exist works properly. + + Keyword Arguments: + self -- This object. + + Return Value: + N/A. + Will trigger an assert if detection mechanism did not work as expected. + """ + + self.username_check(['jackkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk'], + ['Facebook'], + exist_check=False + ) + + return + + def test_detect_false_via_response_url(self): + """Test Username Does Not Exist (Via Response URL). + + This test ensures that the "response URL" detection mechanism of + ensuring that a Username does *not* exist works properly. + + Keyword Arguments: + self -- This object. + + Return Value: + N/A. + Will trigger an assert if detection mechanism did not work as expected. + """ + + self.username_check(['jackkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk'], + ['Pinterest'], + exist_check=False + ) + + return diff --git a/tests/base.py b/tests/base.py new file mode 100644 index 00000000..0f992ba8 --- /dev/null +++ b/tests/base.py @@ -0,0 +1,107 @@ +"""Sherlock Base Tests + +This module contains various utilities for running tests. +""" +import json +import os +import os.path +import unittest +import sherlock +import warnings + + +class SherlockBaseTest(unittest.TestCase): + def setUp(self): + """Sherlock Base Test Setup. + + Does common setup tasks for base Sherlock tests. + + Keyword Arguments: + self -- This object. + + Return Value: + N/A. + """ + + #This ignores the ResourceWarning from an unclosed SSLSocket. + #TODO: Figure out how to fix the code so this is not needed. + warnings.simplefilter("ignore", ResourceWarning) + + # Load the data file with all site information. + data_file_path = os.path.join(os.path.dirname(os.path.realpath(sherlock.__file__)), "data.json") + with open(data_file_path, "r", encoding="utf-8") as raw: + self.site_data_all = json.load(raw) + + self.verbose=False + self.tor=False + self.unique_tor=False + + return + + def site_data_filter(self, site_list): + """Filter Site Data. + + Keyword Arguments: + self -- This object. + site_list -- List of strings corresponding to sites which + should be filtered. + + Return Value: + Dictionary containing sub-set of site data specified by 'site_list'. + """ + + # Create new dictionary that has filtered site data based on input. + # Note that any site specified which is not understood will generate + # an error. + site_data = {} + for site in site_list: + with self.subTest(f"Checking test vector Site '{site}' " + f"exists in total site data." + ): + site_data[site] = self.site_data_all[site] + + return site_data + + def username_check(self, username_list, site_list, exist_check=True): + """Username Exist Check. + + Keyword Arguments: + self -- This object. + username_list -- List of strings corresponding to usernames + which should exist on *all* of the sites. + site_list -- List of strings corresponding to sites which + should be filtered. + exist_check -- Boolean which indicates if this should be + a check for Username existence, + or non-existence. + + Return Value: + N/A. + Will trigger an assert if Username does not have the expected + existence state. + """ + + #Filter all site data down to just what is needed for this test. + site_data = self.site_data_filter(site_list) + + if exist_check: + check_type_text = "exists" + exist_result_desired = "yes" + else: + check_type_text = "does not exist" + exist_result_desired = "no" + + for username in username_list: + results = sherlock.sherlock(username, + site_data, + verbose=self.verbose, + tor=self.tor, + unique_tor=self.unique_tor + ) + for site, result in results.items(): + with self.subTest(f"Checking Username '{username}' " + f"{check_type_text} on Site '{site}'" + ): + self.assertEqual(result['exists'], exist_result_desired) + + return From 4c6bb61483ccbe4ccd924cbe9a5a6f1a638f404a Mon Sep 17 00:00:00 2001 From: "Christopher K. Hoadley" Date: Mon, 21 Jan 2019 19:27:08 -0600 Subject: [PATCH 20/25] Update version number. This version does have basic tests. --- sherlock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sherlock.py b/sherlock.py index 452e04ea..e7fef9d7 100644 --- a/sherlock.py +++ b/sherlock.py @@ -23,7 +23,7 @@ from requests_futures.sessions import FuturesSession from torrequest import TorRequest module_name = "Sherlock: Find Usernames Across Social Networks" -__version__ = "0.2.7" +__version__ = "0.3.0" amount = 0 # TODO: fix tumblr From 32693682e666eb4ccb96b1d884535fd8824fac90 Mon Sep 17 00:00:00 2001 From: cclauss Date: Tue, 22 Jan 2019 09:31:36 +0100 Subject: [PATCH 21/25] Use Travis Continuous Integration to run flake8 on all code changes https://github.com/marketplace/category/continuous-integration To start the automated testing of all pull requests, log into https://travis-ci.com/TheYahya using GitHub credentials and turn the repo switch ___on___. Other tests can be added to the __script:__ section. --- .travis.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..2c52a53a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,25 @@ +group: travis_latest +language: python +cache: pip +matrix: + allow_failures: + - python: nightly + include: + - python: 3.6 + - python: 3.7 + dist: xenial # required for Python >= 3.7 (travis-ci/travis-ci#9069) + - python: nightly + dist: xenial +install: + - pip install -r requirements.txt + - pip install flake8 +before_script: + # stop the build if there are Python syntax errors or undefined names + - flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics +script: + - true # add other tests here +notifications: + on_success: change + on_failure: change # `always` will be the setting once code changes slow down From 11d262eee05d461bf376706395094afac1f25163 Mon Sep 17 00:00:00 2001 From: cclauss Date: Tue, 22 Jan 2019 10:26:16 +0100 Subject: [PATCH 22/25] Add the new unittests to the Travis CI runs. Add @hoadlck unittests. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2c52a53a..0de6f864 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ before_script: # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics script: - - true # add other tests here + - python3 -m unittest tests.all --buffer --verbose notifications: on_success: change on_failure: change # `always` will be the setting once code changes slow down From 290e5efefc62eb394c5d505ec146dc100380af0d Mon Sep 17 00:00:00 2001 From: cclauss Date: Tue, 22 Jan 2019 10:30:32 +0100 Subject: [PATCH 23/25] Also try running the unittests with pytest --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 0de6f864..89d3ecc3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,8 @@ before_script: - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics script: - python3 -m unittest tests.all --buffer --verbose + - pip install pytest + - pytest notifications: on_success: change on_failure: change # `always` will be the setting once code changes slow down From b584a45966a7a8fa93d84164417bbf2e1bf568a9 Mon Sep 17 00:00:00 2001 From: cclauss Date: Tue, 22 Jan 2019 10:35:55 +0100 Subject: [PATCH 24/25] Test files names do not comply with pytest discovery --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 89d3ecc3..0de6f864 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,8 +20,6 @@ before_script: - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics script: - python3 -m unittest tests.all --buffer --verbose - - pip install pytest - - pytest notifications: on_success: change on_failure: change # `always` will be the setting once code changes slow down From cb715a6447ea9a1293d29e6330fc7a33d64c11c7 Mon Sep 17 00:00:00 2001 From: Christopher Kent Hoadley Date: Tue, 22 Jan 2019 11:44:18 -0600 Subject: [PATCH 25/25] Add Travis CI Status Image --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1abf5f85..62cece8a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Sherlock +# Sherlock [![Build Status](https://travis-ci.com/TheYahya/sherlock.svg?branch=master)](https://travis-ci.com/TheYahya/sherlock) > Find usernames across [social networks](https://github.com/theyahya/sherlock/blob/master/sites.md)