@ -1,4 +1,4 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||||
<project version="4"> | <project version="4"> | ||||
<component name="ProjectRootManager" version="2" project-jdk-name="C:\ProgramData\Anaconda3" project-jdk-type="Python SDK" /> | |||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (venv)" project-jdk-type="Python SDK" /> | |||||
</project> | </project> |
@ -0,0 +1,257 @@ | |||||
__author__ = '91Shadows' | |||||
''' | |||||
CryptBB Crawler (Mechanize) | |||||
''' | |||||
import codecs, os, re | |||||
import socks, socket, time | |||||
from datetime import date | |||||
import urllib.parse as urlparse | |||||
import http.client as httplib | |||||
import mechanize | |||||
import subprocess | |||||
from bs4 import BeautifulSoup | |||||
from Forums.Initialization.prepare_parser import new_parse | |||||
from Forums.BestCardingWorld.parser import bestcardingworld_links_parser | |||||
counter = 1 | |||||
httplib.HTTPConnection._http_vsn = 10 | |||||
httplib.HTTPConnection._http_vsn_str = 'HTTP/1.0' | |||||
baseURL = 'http://bestteermb42clir6ux7xm76d4jjodh3fpahjqgbddbmfrgp4skg2wqd.onion/viewforum.php?f=42&sid=ee2cbfd73c12923d979790b2bb4bdfd5' | |||||
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 9150) | |||||
# Opens Tor Browser, crawls the website | |||||
def startCrawling(): | |||||
opentor() | |||||
getUrl() | |||||
forumName = getForumName() | |||||
br = getAccess() | |||||
if br != 'down': | |||||
crawlForum(br) | |||||
new_parse(forumName, False) | |||||
# new_parse(forumName, False) | |||||
closetor() | |||||
# Opens Tor Browser | |||||
def opentor(): | |||||
global pid | |||||
print("Connecting Tor...") | |||||
path = open('../../path.txt').readline() | |||||
pro = subprocess.Popen(path) | |||||
pid = pro.pid | |||||
time.sleep(7.5) | |||||
input("Tor Connected. Press ENTER to continue\n") | |||||
return | |||||
# Creates a connection through Tor Port | |||||
def getUrl(timeout=None): | |||||
socket.socket = socks.socksocket | |||||
socket.create_connection = create_connection | |||||
return | |||||
# Makes the onion address request | |||||
def create_connection(address, timeout=None, source_address=None): | |||||
sock = socks.socksocket() | |||||
sock.connect(address) | |||||
return sock | |||||
# Returns the name of website | |||||
def getForumName(): | |||||
name = 'CryptBB' | |||||
return name | |||||
# Return the link of website | |||||
def getFixedURL(): | |||||
url = 'http://bestteermb42clir6ux7xm76d4jjodh3fpahjqgbddbmfrgp4skg2wqd.onion/viewforum.php?f=42&sid=ee2cbfd73c12923d979790b2bb4bdfd5' | |||||
return url | |||||
# Closes Tor Browser | |||||
def closetor(): | |||||
global pid | |||||
os.system("taskkill /pid " + str(pid)) | |||||
print('Closing Tor...') | |||||
time.sleep(3) | |||||
return | |||||
# Creates a Mechanize browser and initializes its options | |||||
def createBrowser(): | |||||
br = mechanize.Browser() | |||||
cj = mechanize.CookieJar() | |||||
br.set_cookiejar(cj) | |||||
# Browser options | |||||
br.set_handle_equiv(True) | |||||
br.set_handle_redirect(True) | |||||
br.set_handle_referer(True) | |||||
br.set_handle_robots(False) | |||||
br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1) | |||||
br.addheaders = [('User-agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko'), | |||||
('Accept', '*/*')] | |||||
return br | |||||
def getAccess(): | |||||
url = getFixedURL() | |||||
br = createBrowser() | |||||
try: | |||||
br.open(url) | |||||
return br | |||||
except: | |||||
return 'down' | |||||
# Saves the crawled html page | |||||
def savePage(page, url): | |||||
filePath = getFullPathName(url) | |||||
os.makedirs(os.path.dirname(filePath), exist_ok=True) | |||||
a = page.read() | |||||
open(filePath, "wb").write(a) | |||||
return | |||||
# Gets the full path of the page to be saved along with its appropriate file name | |||||
def getFullPathName(url): | |||||
fileName = getNameFromURL(url) | |||||
if isDescriptionLink(url): | |||||
fullPath = 'C:/Users/CALSysLab/Documents/threatIntelligence-main/DarkWebMining_Working/Forums/BestCardingWorld/HTML_Pages/' + str( | |||||
"%02d" % date.today().month) + str("%02d" % date.today().day) + str( | |||||
"%04d" % date.today().year) + '/' + 'Description/' + fileName + '.html' | |||||
else: | |||||
fullPath = 'C:/Users/CALSysLab/Documents/threatIntelligence-main/DarkWebMining_Working/Forums/BestCardingWorld/HTML_Pages/' + str( | |||||
"%02d" % date.today().month) + str("%02d" % date.today().day) + str( | |||||
"%04d" % date.today().year) + '/' + 'Listing/' + fileName + '.html' | |||||
return fullPath | |||||
# Creates the name of the file based on URL | |||||
def getNameFromURL(url): | |||||
global counter | |||||
name = ''.join(e for e in url if e.isalnum()) | |||||
if (name == ''): | |||||
name = str(counter) | |||||
counter = counter + 1 | |||||
return name | |||||
# Hacking and Markets related topics | |||||
def getInterestedLinks(): | |||||
links = [] | |||||
links.append('http://bestteermb42clir6ux7xm76d4jjodh3fpahjqgbddbmfrgp4skg2wqd.onion/viewforum.php?f=43&sid=e12864ffccc5df877b03b573534955be') | |||||
return links | |||||
# Start crawling Forum pages | |||||
def crawlForum(br): | |||||
print("Crawling CryptBB forum") | |||||
linksToCrawl = getInterestedLinks() | |||||
visited = set(linksToCrawl) | |||||
initialTime = time.time() | |||||
i = 0 | |||||
while i < len(linksToCrawl): | |||||
link = linksToCrawl[i] | |||||
print('Crawling :', link) | |||||
try: | |||||
page = br.open(link) | |||||
savePage(page, link) | |||||
res = br.response().read() | |||||
soup = BeautifulSoup(res, 'html.parser') | |||||
next_link = soup.find("a", {"rel": "next"}) | |||||
if next_link != None: | |||||
full_url = urlparse.urljoin(linksToCrawl[i], next_link['href']) | |||||
linksToCrawl.insert(i + 1, full_url) | |||||
listOfTopics = findDescriptionPages(link) | |||||
for topic in listOfTopics: | |||||
itemPage = br.open(str(topic)) | |||||
savePage(itemPage, topic) | |||||
except Exception as e: | |||||
print('Error getting link: ', link, e) | |||||
i += 1 | |||||
# finalTime = time.time() | |||||
# print finalTime - initialTime | |||||
input("CryptBB forum done sucessfully. Press ENTER to continue\n") | |||||
return | |||||
# Returns True if the link is 'Topic' Links, may need to change for diff websites | |||||
def isDescriptionLink(url): | |||||
if 'topic' in url: | |||||
return True | |||||
return False | |||||
# Returns True if the link is a listingPage link, may need to change for diff websites | |||||
def isListingLink(url): | |||||
''' | |||||
reg = 'board=[0-9]+.[0-9]+\Z' | |||||
if len(re.findall(reg, url)) == 0: | |||||
return False | |||||
return True | |||||
''' | |||||
if 'forum' in url: | |||||
return True | |||||
return False | |||||
# calling the parser to define the links | |||||
def findDescriptionPages(url): | |||||
soup = "" | |||||
error = False | |||||
try: | |||||
html = codecs.open( | |||||
"C:\\Users\\CALSysLab\\Documents\\threatIntelligence-main\\DarkWebMining_Working\\Forums\\BestCardingWorld\\HTML_Pages\\" + str( | |||||
"%02d" % date.today().month) + str("%02d" % date.today().day) + str( | |||||
"%04d" % date.today().year) + "\\Listing\\" + getNameFromURL(url) + ".html", encoding='utf8') | |||||
soup = BeautifulSoup(html, "html.parser") | |||||
except: | |||||
try: | |||||
html = open( | |||||
"C:\\Users\\CALSysLab\\Documents\\threatIntelligence-main\\DarkWebMining_Working\\Forums\\BestCardingWorld\\HTML_Pages\\" + str( | |||||
"%02d" % date.today().month) + str("%02d" % date.today().day) + str( | |||||
"%04d" % date.today().year) + "\\Listing\\" + getNameFromURL(url) + ".html") | |||||
soup = BeautifulSoup(html, "html.parser") | |||||
except: | |||||
error = True | |||||
print("There was a problem to read the file " + getNameFromURL(url) + " in the listing section.") | |||||
if not error: | |||||
return bestcardingworld_links_parser(soup) | |||||
else: | |||||
return [] | |||||
def crawler(): | |||||
startCrawling() | |||||
print("Crawling and Parsing CryptBB .... DONE!") |
@ -4318,6 +4318,7 @@ JavaScript error: resource://gre/modules/ExtensionTelemetry.jsm, line 109: Error | |||||
JavaScript error: resource://gre/modules/ExtensionTelemetry.jsm, line 113: Error: TelemetryStopwatch: finishing nonexisting stopwatch. Histogram: "WEBEXT_CONTENT_SCRIPT_INJECTION_MS_BY_ADDONID", key: "{73a6fe31-595d-460b-a920-fcc0f8843232}" | JavaScript error: resource://gre/modules/ExtensionTelemetry.jsm, line 113: Error: TelemetryStopwatch: finishing nonexisting stopwatch. Histogram: "WEBEXT_CONTENT_SCRIPT_INJECTION_MS_BY_ADDONID", key: "{73a6fe31-595d-460b-a920-fcc0f8843232}" | ||||
JavaScript error: resource://gre/modules/ExtensionTelemetry.jsm, line 109: Error: TelemetryStopwatch: finishing nonexisting stopwatch. Histogram: "WEBEXT_CONTENT_SCRIPT_INJECTION_MS", key: "" | JavaScript error: resource://gre/modules/ExtensionTelemetry.jsm, line 109: Error: TelemetryStopwatch: finishing nonexisting stopwatch. Histogram: "WEBEXT_CONTENT_SCRIPT_INJECTION_MS", key: "" | ||||
JavaScript error: resource://gre/modules/ExtensionTelemetry.jsm, line 113: Error: TelemetryStopwatch: finishing nonexisting stopwatch. Histogram: "WEBEXT_CONTENT_SCRIPT_INJECTION_MS_BY_ADDONID", key: "{73a6fe31-595d-460b-a920-fcc0f8843232}" | JavaScript error: resource://gre/modules/ExtensionTelemetry.jsm, line 113: Error: TelemetryStopwatch: finishing nonexisting stopwatch. Histogram: "WEBEXT_CONTENT_SCRIPT_INJECTION_MS_BY_ADDONID", key: "{73a6fe31-595d-460b-a920-fcc0f8843232}" | ||||
<<<<<<< HEAD | |||||
>>>>>>> f804c1eb5950e89e7c55aa9044560646cbd911ee | >>>>>>> f804c1eb5950e89e7c55aa9044560646cbd911ee | ||||
1686782889434 geckodriver INFO Listening on 127.0.0.1:55993 | 1686782889434 geckodriver INFO Listening on 127.0.0.1:55993 | ||||
1686782894019 mozrunner::runner INFO Running command: "C:\\Users\\minhkhoitran\\Desktop\\Tor Browser\\Browser\\firefox.exe" "--marionette" "--remote-debugging-port" "55994" "--remote-allow-hosts" "localhost" "-no-remote" "-profile" "C:\\Users\\MINHKH~1\\AppData\\Local\\Temp\\rust_mozprofileOgkkAM" | 1686782894019 mozrunner::runner INFO Running command: "C:\\Users\\minhkhoitran\\Desktop\\Tor Browser\\Browser\\firefox.exe" "--marionette" "--remote-debugging-port" "55994" "--remote-allow-hosts" "localhost" "-no-remote" "-profile" "C:\\Users\\MINHKH~1\\AppData\\Local\\Temp\\rust_mozprofileOgkkAM" | ||||
@ -4352,11 +4353,25 @@ start@resource://gre/modules/TorProcess.jsm:81:12 | |||||
console.error: TorMonitorService: | console.error: TorMonitorService: | ||||
Tor not running, not starting to monitor it. | Tor not running, not starting to monitor it. | ||||
1686782895293 RemoteAgent WARN TLS certificate errors will be ignored for this session | 1686782895293 RemoteAgent WARN TLS certificate errors will be ignored for this session | ||||
======= | |||||
1687240079948 geckodriver INFO Listening on 127.0.0.1:50448 | |||||
1687240084735 mozrunner::runner INFO Running command: "C:\\Users\\calsyslab\\Desktop\\Tor Browser\\Browser\\firefox.exe" "--marionette" "--remote-debugging-port" "50449" "--remote-allow-hosts" "localhost" "-no-remote" "-profile" "C:\\Users\\CALSYS~1\\AppData\\Local\\Temp\\rust_mozprofileuYe2AP" | |||||
console.log: "TorSettings: loadFromPrefs()" | |||||
console.log: "TorConnect: init()" | |||||
console.log: "TorConnect: Entering Initial state" | |||||
console.log: "TorConnect: Observed profile-after-change" | |||||
console.log: "TorConnect: Observing topic 'TorProcessExited'" | |||||
console.log: "TorConnect: Observing topic 'TorLogHasWarnOrErr'" | |||||
console.log: "TorConnect: Observing topic 'torsettings:ready'" | |||||
console.log: "TorSettings: Observed profile-after-change" | |||||
1687240085868 Marionette INFO Marionette enabled | |||||
>>>>>>> d30c8066e307536b5e951ec07a15f08833074d5e | |||||
console.log: "TorConnect: Will load after bootstrap => [about:blank]" | console.log: "TorConnect: Will load after bootstrap => [about:blank]" | ||||
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory. | JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory. | ||||
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory. | JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory. | ||||
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory. | JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory. | ||||
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory. | JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory. | ||||
<<<<<<< HEAD | |||||
JavaScript error: resource://gre/modules/XPCOMUtils.jsm, line 161: TypeError: Cc[aContract] is undefined | JavaScript error: resource://gre/modules/XPCOMUtils.jsm, line 161: TypeError: Cc[aContract] is undefined | ||||
DevTools listening on ws://localhost:55994/devtools/browser/705394f9-2ee0-40c2-afa4-edbb645f03a8 | DevTools listening on ws://localhost:55994/devtools/browser/705394f9-2ee0-40c2-afa4-edbb645f03a8 | ||||
JavaScript error: resource://gre/modules/PromiseWorker.jsm, line 106: Error: Could not get children of file(C:\Users\MINHKH~1\AppData\Local\Temp\rust_mozprofileOgkkAM\thumbnails) because it does not exist | JavaScript error: resource://gre/modules/PromiseWorker.jsm, line 106: Error: Could not get children of file(C:\Users\MINHKH~1\AppData\Local\Temp\rust_mozprofileOgkkAM\thumbnails) because it does not exist | ||||
@ -4397,11 +4412,63 @@ console.error: TorMonitorService: | |||||
Tor not running, not starting to monitor it. | Tor not running, not starting to monitor it. | ||||
1686853973687 RemoteAgent WARN TLS certificate errors will be ignored for this session | 1686853973687 RemoteAgent WARN TLS certificate errors will be ignored for this session | ||||
console.log: "TorConnect: Will load after bootstrap => [about:blank]" | console.log: "TorConnect: Will load after bootstrap => [about:blank]" | ||||
======= | |||||
console.error: "Could not load engine [email protected]: Error: Extension is invalid" | |||||
JavaScript error: resource://gre/modules/XPCOMUtils.jsm, line 161: TypeError: Cc[aContract] is undefined | |||||
DevTools listening on ws://localhost:50449/devtools/browser/e85e6865-1f97-480a-8e46-778271184a87 | |||||
1687240090364 Marionette INFO Listening on port 50454 | |||||
1687240090846 RemoteAgent WARN TLS certificate errors will be ignored for this session | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/, line 2: ReferenceError: $ is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/member.php?action=login, line 2: ReferenceError: $ is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/member.php?action=login, line 5: ReferenceError: lang is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/member.php?action=login, line 9: ReferenceError: use_xmlhttprequest is not defined | |||||
JavaScript error: resource://gre/modules/PromiseWorker.jsm, line 106: Error: Could not get children of file(C:\Users\calsyslab\AppData\Local\Temp\rust_mozprofileuYe2AP\thumbnails) because it does not exist | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/forumdisplay.php?fid=86, line 3: ReferenceError: lang is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/jscripts/jeditable/jeditable.min.js, line 38: ReferenceError: jQuery is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/jscripts/inline_edit.js?ver=1808, line 6: ReferenceError: $ is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/showthread.php?tid=2628, line 6: ReferenceError: lang is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/jscripts/report.js?ver=1804, line 4: ReferenceError: $ is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/jscripts/jeditable/jeditable.min.js, line 38: ReferenceError: jQuery is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/jscripts/thread.js?ver=1809, line 4: ReferenceError: $ is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/showthread.php?tid=2628, line 19: ReferenceError: use_xmlhttprequest is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/showthread.php?tid=2628, line 25: ReferenceError: $ is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/showthread.php?tid=2628&page=2, line 6: ReferenceError: lang is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/jscripts/report.js?ver=1804, line 4: ReferenceError: $ is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/jscripts/jeditable/jeditable.min.js, line 38: ReferenceError: jQuery is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/jscripts/thread.js?ver=1809, line 4: ReferenceError: $ is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/showthread.php?tid=2628&page=2, line 19: ReferenceError: use_xmlhttprequest is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/showthread.php?tid=2628&page=2, line 25: ReferenceError: $ is not defined | |||||
1687240218310 Marionette INFO Stopped listening on port 50454 | |||||
JavaScript error: resource:///modules/Interactions.jsm, line 209: NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIUserIdleService.removeIdleObserver] | |||||
!!! error running onStopped callback: TypeError: callback is not a function | |||||
JavaScript error: resource:///modules/sessionstore/SessionFile.jsm, line 375: Error: _initWorker called too early! Please read the session file from disk first. | |||||
JavaScript error: resource://gre/modules/PromiseWorker.jsm, line 106: Error: Could not get children of file(C:\Users\calsyslab\AppData\Local\Temp\rust_mozprofileuYe2AP\thumbnails) because it does not exist | |||||
1687240220095 RemoteAgent ERROR unable to stop listener: [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIWindowMediator.getEnumerator]" nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)" location: "JS frame :: chrome://remote/content/cdp/observers/TargetObserver.jsm :: stop :: line 64" data: no] Stack trace: stop()@TargetObserver.jsm:64 | |||||
unwatchForTabs()@TargetList.jsm:70 | |||||
unwatchForTargets()@TargetList.jsm:37 | |||||
destructor()@TargetList.jsm:109 | |||||
stop()@CDP.jsm:104 | |||||
close()@RemoteAgent.jsm:138 | |||||
1687240311209 geckodriver INFO Listening on 127.0.0.1:50519 | |||||
1687240315070 mozrunner::runner INFO Running command: "C:\\Users\\calsyslab\\Desktop\\Tor Browser\\Browser\\firefox.exe" "--marionette" "--remote-debugging-port" "50520" "--remote-allow-hosts" "localhost" "-no-remote" "-profile" "C:\\Users\\CALSYS~1\\AppData\\Local\\Temp\\rust_mozprofiletzrkDs" | |||||
console.log: "TorSettings: loadFromPrefs()" | |||||
console.log: "TorConnect: init()" | |||||
console.log: "TorConnect: Entering Initial state" | |||||
console.log: "TorConnect: Observed profile-after-change" | |||||
console.log: "TorConnect: Observing topic 'TorProcessExited'" | |||||
console.log: "TorConnect: Observing topic 'TorLogHasWarnOrErr'" | |||||
console.log: "TorConnect: Observing topic 'torsettings:ready'" | |||||
console.log: "TorSettings: Observed profile-after-change" | |||||
1687240315958 Marionette INFO Marionette enabled | |||||
console.log: "TorConnect: Will load after bootstrap => [about:blank]" | |||||
console.error: "Could not load engine [email protected]: Error: Extension is invalid" | |||||
>>>>>>> d30c8066e307536b5e951ec07a15f08833074d5e | |||||
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory. | JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory. | ||||
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory. | JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory. | ||||
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory. | JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory. | ||||
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory. | JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory. | ||||
JavaScript error: resource://gre/modules/XPCOMUtils.jsm, line 161: TypeError: Cc[aContract] is undefined | JavaScript error: resource://gre/modules/XPCOMUtils.jsm, line 161: TypeError: Cc[aContract] is undefined | ||||
<<<<<<< HEAD | |||||
DevTools listening on ws://localhost:50008/devtools/browser/15543a67-b1fe-427a-8516-16fe520676d3 | DevTools listening on ws://localhost:50008/devtools/browser/15543a67-b1fe-427a-8516-16fe520676d3 | ||||
console.warn: LoginRecipes: "getRecipes: falling back to a synchronous message for:" "http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion" | console.warn: LoginRecipes: "getRecipes: falling back to a synchronous message for:" "http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion" | ||||
console.warn: LoginRecipes: "getRecipes: falling back to a synchronous message for:" "http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion" | console.warn: LoginRecipes: "getRecipes: falling back to a synchronous message for:" "http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion" | ||||
@ -4620,3 +4687,54 @@ JavaScript error: resource://gre/modules/PromiseWorker.jsm, line 106: Error: Cou | |||||
JavaScript error: resource://gre/modules/AsyncShutdown.jsm, line 575: uncaught exception: SessionFileInternal.getWriter() called too early! Please read the session file from disk first. | JavaScript error: resource://gre/modules/AsyncShutdown.jsm, line 575: uncaught exception: SessionFileInternal.getWriter() called too early! Please read the session file from disk first. | ||||
JavaScript error: resource://gre/modules/PromiseWorker.jsm, line 106: Error: Could not get children of file(C:\Users\MINHKH~1\AppData\Local\Temp\rust_mozprofilexDqUwM\thumbnails) because it does not exist | JavaScript error: resource://gre/modules/PromiseWorker.jsm, line 106: Error: Could not get children of file(C:\Users\MINHKH~1\AppData\Local\Temp\rust_mozprofilexDqUwM\thumbnails) because it does not exist | ||||
[Parent 7372, IPC I/O Parent] WARNING: pipe error: 232: file /var/tmp/build/firefox-cc1bd3d61c87/ipc/chromium/src/chrome/common/ipc_channel_win.cc:554 | [Parent 7372, IPC I/O Parent] WARNING: pipe error: 232: file /var/tmp/build/firefox-cc1bd3d61c87/ipc/chromium/src/chrome/common/ipc_channel_win.cc:554 | ||||
======= | |||||
DevTools listening on ws://localhost:50520/devtools/browser/4b6276ea-c420-4b6d-b4bc-fda679f97800 | |||||
1687240317156 Marionette INFO Listening on port 50525 | |||||
1687240317256 RemoteAgent WARN TLS certificate errors will be ignored for this session | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/, line 2: ReferenceError: $ is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/member.php?action=login, line 2: ReferenceError: $ is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/member.php?action=login, line 5: ReferenceError: lang is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/member.php?action=login, line 9: ReferenceError: use_xmlhttprequest is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/forumdisplay.php?fid=86, line 3: ReferenceError: lang is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/jscripts/jeditable/jeditable.min.js, line 38: ReferenceError: jQuery is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/jscripts/inline_edit.js?ver=1808, line 6: ReferenceError: $ is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/showthread.php?tid=2628, line 6: ReferenceError: lang is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/jscripts/report.js?ver=1804, line 4: ReferenceError: $ is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/jscripts/jeditable/jeditable.min.js, line 38: ReferenceError: jQuery is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/jscripts/thread.js?ver=1809, line 4: ReferenceError: $ is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/showthread.php?tid=2628, line 19: ReferenceError: use_xmlhttprequest is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/showthread.php?tid=2628, line 25: ReferenceError: $ is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/forumdisplay.php?fid=86, line 3: ReferenceError: lang is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/jscripts/jeditable/jeditable.min.js, line 38: ReferenceError: jQuery is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/jscripts/inline_edit.js?ver=1808, line 6: ReferenceError: $ is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/forumdisplay.php?fid=86&page=2, line 3: ReferenceError: lang is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/jscripts/jeditable/jeditable.min.js, line 38: ReferenceError: jQuery is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/jscripts/inline_edit.js?ver=1808, line 6: ReferenceError: $ is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/showthread.php?tid=16404, line 6: ReferenceError: lang is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/jscripts/report.js?ver=1804, line 4: ReferenceError: $ is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/jscripts/jeditable/jeditable.min.js, line 38: ReferenceError: jQuery is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/jscripts/thread.js?ver=1809, line 4: ReferenceError: $ is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/showthread.php?tid=16404, line 19: ReferenceError: use_xmlhttprequest is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/showthread.php?tid=16404, line 25: ReferenceError: $ is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/forumdisplay.php?fid=86&page=2, line 3: ReferenceError: lang is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/jscripts/jeditable/jeditable.min.js, line 38: ReferenceError: jQuery is not defined | |||||
JavaScript error: http://cryptbbtg65gibadeeo2awe3j7s6evg7eklserehqr4w4e2bis5tebid.onion/jscripts/inline_edit.js?ver=1808, line 6: ReferenceError: $ is not defined | |||||
1687240409940 Marionette INFO Stopped listening on port 50525 | |||||
JavaScript error: resource:///modules/Interactions.jsm, line 209: NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIUserIdleService.removeIdleObserver] | |||||
###!!! [Parent][MessageChannel] Error: (msgtype=0x140007,name=PBackgroundLSDatabase::Msg_RequestAllowToClose) Channel error: cannot send/recv | |||||
[Parent 1036, IPC I/O Parent] WARNING: file /var/tmp/build/firefox-b6010b1466c9/ipc/chromium/src/base/process_util_win.cc:167 | |||||
!!! error running onStopped callback: TypeError: callback is not a function | |||||
JavaScript error: resource:///modules/sessionstore/SessionFile.jsm, line 375: Error: _initWorker called too early! Please read the session file from disk first. | |||||
JavaScript error: resource://gre/modules/PromiseWorker.jsm, line 106: Error: Could not get children of file(C:\Users\calsyslab\AppData\Local\Temp\rust_mozprofiletzrkDs\thumbnails) because it does not exist | |||||
###!!! [Child][MessageChannel] Error: (msgtype=0x5D0005,name=PImageBridge::Msg_WillClose) Channel error: cannot send/recv | |||||
1687240410572 RemoteAgent ERROR unable to stop listener: [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIWindowMediator.getEnumerator]" nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)" location: "JS frame :: chrome://remote/content/cdp/observers/TargetObserver.jsm :: stop :: line 64" data: no] Stack trace: stop()@TargetObserver.jsm:64 | |||||
unwatchForTabs()@TargetList.jsm:70 | |||||
unwatchForTargets()@TargetList.jsm:37 | |||||
destructor()@TargetList.jsm:109 | |||||
stop()@CDP.jsm:104 | |||||
close()@RemoteAgent.jsm:138 | |||||
>>>>>>> d30c8066e307536b5e951ec07a15f08833074d5e |
@ -6073,3 +6073,35 @@ unwatchForTargets()@TargetList.jsm:37 | |||||
destructor()@TargetList.jsm:109 | destructor()@TargetList.jsm:109 | ||||
stop()@CDP.jsm:104 | stop()@CDP.jsm:104 | ||||
close()@RemoteAgent.jsm:138 | close()@RemoteAgent.jsm:138 | ||||
1687245533907 geckodriver INFO Listening on 127.0.0.1:62051 | |||||
1687245536832 mozrunner::runner INFO Running command: "C:\\Users\\calsyslab\\Desktop\\Tor Browser\\Browser\\firefox.exe" "--marionette" "--remote-debugging-port" "62052" "--remote-allow-hosts" "localhost" "-no-remote" "-profile" "C:\\Users\\CALSYS~1\\AppData\\Local\\Temp\\rust_mozprofileuMGaeY" | |||||
console.log: "TorSettings: loadFromPrefs()" | |||||
console.log: "TorConnect: init()" | |||||
console.log: "TorConnect: Entering Initial state" | |||||
console.log: "TorConnect: Observed profile-after-change" | |||||
console.log: "TorConnect: Observing topic 'TorProcessExited'" | |||||
console.log: "TorConnect: Observing topic 'TorLogHasWarnOrErr'" | |||||
console.log: "TorConnect: Observing topic 'torsettings:ready'" | |||||
console.log: "TorSettings: Observed profile-after-change" | |||||
1687245537956 Marionette INFO Marionette enabled | |||||
console.log: "TorConnect: Will load after bootstrap => [about:blank]" | |||||
console.error: "Could not load engine [email protected]: Error: Extension is invalid" | |||||
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory. | |||||
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory. | |||||
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory. | |||||
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory. | |||||
JavaScript error: resource://gre/modules/XPCOMUtils.jsm, line 161: TypeError: Cc[aContract] is undefined | |||||
DevTools listening on ws://localhost:62052/devtools/browser/9cf17e56-2fb1-468d-b65e-15c4de4eaa64 | |||||
1687245540759 Marionette INFO Listening on port 49935 | |||||
1687245540897 RemoteAgent WARN TLS certificate errors will be ignored for this session | |||||
1687245639406 Marionette INFO Stopped listening on port 49935 | |||||
JavaScript error: resource:///modules/Interactions.jsm, line 209: NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIUserIdleService.removeIdleObserver] | |||||
!!! error running onStopped callback: TypeError: callback is not a function | |||||
JavaScript error: resource:///modules/sessionstore/SessionFile.jsm, line 375: Error: _initWorker called too early! Please read the session file from disk first. | |||||
JavaScript error: resource://gre/modules/PageThumbs.jsm, line 709: AbortError: IOUtils.profileBeforeChange getter: IOUtils: profileBeforeChange phase has already finished | |||||
1687245650576 RemoteAgent ERROR unable to stop listener: [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIWindowMediator.getEnumerator]" nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)" location: "JS frame :: chrome://remote/content/cdp/observers/TargetObserver.jsm :: stop :: line 64" data: no] Stack trace: stop()@TargetObserver.jsm:64 | |||||
unwatchForTabs()@TargetList.jsm:70 | |||||
unwatchForTargets()@TargetList.jsm:37 | |||||
destructor()@TargetList.jsm:109 | |||||
stop()@CDP.jsm:104 | |||||
close()@RemoteAgent.jsm:138 |
@ -1 +1 @@ | |||||
Tor2door | |||||
Tor2door |
@ -0,0 +1,309 @@ | |||||
__author__ = 'Helium' | |||||
''' | |||||
ThiefWorld Forum Crawler (Selenium) | |||||
''' | |||||
from selenium import webdriver | |||||
from selenium.common.exceptions import NoSuchElementException | |||||
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile | |||||
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary | |||||
from selenium.webdriver.firefox.service import Service | |||||
from selenium.webdriver.support.ui import WebDriverWait | |||||
from selenium.webdriver.support import expected_conditions as EC | |||||
from selenium.webdriver.common.by import By | |||||
from PIL import Image | |||||
import urllib.parse as urlparse | |||||
import os, re, time | |||||
from datetime import date | |||||
import subprocess | |||||
import configparser | |||||
from bs4 import BeautifulSoup | |||||
from MarketPlaces.Initialization.prepare_parser import new_parse | |||||
from MarketPlaces.ThiefWorld.parser import thiefworld_links_parser | |||||
from MarketPlaces.Utilities.utilities import cleanHTML | |||||
config = configparser.ConfigParser() | |||||
config.read('../../setup.ini') | |||||
counter = 1 | |||||
baseURL = 'http://qsw7iurcrdwyml5kg4oxbmtqrcnpxiag3iumdarefzeunnyc2dnyljad.onion/' | |||||
# Opens Tor Browser, crawls the website, then parses, then closes tor | |||||
#acts like the main method for the crawler, another function at the end of this code calls this function later | |||||
def startCrawling(): | |||||
opentor() | |||||
# mktName = getMKTName() | |||||
driver = getAccess() | |||||
if driver != 'down': | |||||
try: | |||||
login(driver) | |||||
crawlForum(driver) | |||||
except Exception as e: | |||||
print(driver.current_url, e) | |||||
closetor(driver) | |||||
# new_parse(mktName, False) | |||||
# Opens Tor Browser | |||||
#prompts for ENTER input to continue | |||||
def opentor(): | |||||
global pid | |||||
print("Connecting Tor...") | |||||
pro = subprocess.Popen(config.get('TOR', 'firefox_binary_path')) | |||||
pid = pro.pid | |||||
time.sleep(7.5) | |||||
input('Tor Connected. Press ENTER to continue\n') | |||||
return | |||||
# Returns the name of the website | |||||
#return: name of site in string type | |||||
def getMKTName(): | |||||
name = 'ThiefWorld' | |||||
return name | |||||
# Return the base link of the website | |||||
#return: url of base site in string type | |||||
def getFixedURL(): | |||||
url = 'http://qsw7iurcrdwyml5kg4oxbmtqrcnpxiag3iumdarefzeunnyc2dnyljad.onion/' | |||||
return url | |||||
# Closes Tor Browser | |||||
#@param: current selenium driver | |||||
def closetor(driver): | |||||
# global pid | |||||
# os.system("taskkill /pid " + str(pro.pid)) | |||||
# os.system("taskkill /t /f /im tor.exe") | |||||
print('Closing Tor...') | |||||
driver.close() | |||||
time.sleep(3) | |||||
return | |||||
# Creates FireFox 'driver' and configure its 'Profile' | |||||
# to use Tor proxy and socket | |||||
def createFFDriver(): | |||||
ff_binary = FirefoxBinary(config.get('TOR', 'firefox_binary_path')) | |||||
ff_prof = FirefoxProfile(config.get('TOR', 'firefox_profile_path')) | |||||
ff_prof.set_preference("places.history.enabled", False) | |||||
ff_prof.set_preference("privacy.clearOnShutdown.offlineApps", True) | |||||
ff_prof.set_preference("privacy.clearOnShutdown.passwords", True) | |||||
ff_prof.set_preference("privacy.clearOnShutdown.siteSettings", True) | |||||
ff_prof.set_preference("privacy.sanitize.sanitizeOnShutdown", True) | |||||
ff_prof.set_preference("signon.rememberSignons", False) | |||||
ff_prof.set_preference("network.cookie.lifetimePolicy", 2) | |||||
ff_prof.set_preference("network.dns.disablePrefetch", True) | |||||
ff_prof.set_preference("network.http.sendRefererHeader", 0) | |||||
ff_prof.set_preference("permissions.default.image", 2) | |||||
ff_prof.set_preference("browser.download.folderList", 2) | |||||
ff_prof.set_preference("browser.download.manager.showWhenStarting", False) | |||||
ff_prof.set_preference("browser.helperApps.neverAsk.saveToDisk", "text/plain") | |||||
ff_prof.set_preference('network.proxy.type', 1) | |||||
ff_prof.set_preference("network.proxy.socks_version", 5) | |||||
ff_prof.set_preference('network.proxy.socks', '127.0.0.1') | |||||
ff_prof.set_preference('network.proxy.socks_port', 9150) | |||||
ff_prof.set_preference('network.proxy.socks_remote_dns', True) | |||||
ff_prof.set_preference("javascript.enabled", False) | |||||
ff_prof.update_preferences() | |||||
service = Service(config.get('TOR', 'geckodriver_path')) | |||||
driver = webdriver.Firefox(firefox_binary=ff_binary, firefox_profile=ff_prof, service=service) | |||||
return driver | |||||
#the driver 'gets' the url, attempting to get on the site, if it can't access return 'down' | |||||
#return: return the selenium driver or string 'down' | |||||
def getAccess(): | |||||
url = getFixedURL() | |||||
driver = createFFDriver() | |||||
try: | |||||
driver.get(url) | |||||
return driver | |||||
except: | |||||
driver.close() | |||||
return 'down' | |||||
# Manual captcha solver, waits fora specific element so that the whole page loads, finds the input box, gets screenshot of captcha | |||||
# then allows for manual solving of captcha in the terminal | |||||
#@param: current selenium web driver | |||||
def login(driver): | |||||
# wait for page to show up (This Xpath may need to change based on different seed url) | |||||
WebDriverWait(driver, 100).until(EC.visibility_of_element_located( | |||||
(By.XPATH, "/html/body/div/div[1]/div/div[1]/div[1]/ul"))) | |||||
temp = driver.find_element(By.XPATH, '/html/body/div/header/div[2]/div/nav/div[2]/a[1]').get_attribute( | |||||
'href') # /html/body/div/div[2]/div/div[2]/div | |||||
link = urlparse.urljoin(baseURL, str(temp)) | |||||
driver.get(link) # open | |||||
# wait for listing page show up (This Xpath may need to change based on different seed url) | |||||
WebDriverWait(driver, 100).until(EC.visibility_of_element_located( | |||||
(By.ID, "side-bar"))) | |||||
# Saves the crawled html page, makes the directory path for html pages if not made | |||||
def savePage(page, url): | |||||
cleanPage = cleanHTML(page) | |||||
filePath = getFullPathName(url) | |||||
os.makedirs(os.path.dirname(filePath), exist_ok=True) | |||||
open(filePath, 'wb').write(cleanPage.encode('utf-8')) | |||||
return | |||||
# Gets the full path of the page to be saved along with its appropriate file name | |||||
#@param: raw url as crawler crawls through every site | |||||
def getFullPathName(url): | |||||
from MarketPlaces.Initialization.markets_mining import CURRENT_DATE | |||||
fileName = getNameFromURL(url) | |||||
if isDescriptionLink(url): | |||||
fullPath = r'..\ThiefWorld\HTML_Pages\\' + CURRENT_DATE + r'\\Description\\' + fileName + '.html' | |||||
else: | |||||
fullPath = r'..\ThiefWorld\HTML_Pages\\' + CURRENT_DATE + r'\\Listing\\' + fileName + '.html' | |||||
return fullPath | |||||
# Creates the file name from passed URL, gives distinct name if can't be made unique after cleaned | |||||
#@param: raw url as crawler crawls through every site | |||||
def getNameFromURL(url): | |||||
global counter | |||||
name = ''.join(e for e in url if e.isalnum()) | |||||
if (name == ''): | |||||
name = str(counter) | |||||
counter = counter + 1 | |||||
return name | |||||
# returns list of urls, here is where you can list the different urls of interest, the crawler runs through this list | |||||
#in this example, there are a couple of categories some threads fall under such as | |||||
# Guides and Tutorials, Digital Products, and Software and Malware | |||||
#as you can see they are categories of products | |||||
def getInterestedLinks(): | |||||
links = [] | |||||
# Hacking and DDOS | |||||
links.append('http://qsw7iurcrdwyml5kg4oxbmtqrcnpxiag3iumdarefzeunnyc2dnyljad.onion/catalog/35') | |||||
# # Carding Manuals | |||||
# links.append('http://qsw7iurcrdwyml5kg4oxbmtqrcnpxiag3iumdarefzeunnyc2dnyljad.onion/catalog/20') | |||||
# # Software | |||||
# links.append('http://qsw7iurcrdwyml5kg4oxbmtqrcnpxiag3iumdarefzeunnyc2dnyljad.onion/catalog/37') | |||||
# # Database | |||||
# links.append('http://qsw7iurcrdwyml5kg4oxbmtqrcnpxiag3iumdarefzeunnyc2dnyljad.onion/catalog/38') | |||||
return links | |||||
# gets links of interest to crawl through, iterates through list, where each link is clicked and crawled through | |||||
#topic and description pages are crawled through here, where both types of pages are saved | |||||
#@param: selenium driver | |||||
def crawlForum(driver): | |||||
print("Crawling the ThiefWorld market") | |||||
linksToCrawl = getInterestedLinks() | |||||
visited = set(linksToCrawl) | |||||
initialTime = time.time() | |||||
count = 0 | |||||
i = 0 | |||||
while i < len(linksToCrawl): | |||||
link = linksToCrawl[i] | |||||
print('Crawling :', link) | |||||
try: | |||||
try: | |||||
driver.get(link) | |||||
except: | |||||
driver.refresh() | |||||
html = driver.page_source | |||||
savePage(html, link) | |||||
has_next_page = True | |||||
while has_next_page: | |||||
list = productPages(html) | |||||
for item in list: | |||||
itemURL = urlparse.urljoin(baseURL, str(item)) | |||||
try: | |||||
driver.get(itemURL) | |||||
except: | |||||
driver.refresh() | |||||
savePage(driver.page_source, item) | |||||
driver.back() | |||||
# comment out | |||||
break | |||||
# comment out | |||||
if count == 1: | |||||
count = 0 | |||||
break | |||||
try: | |||||
link = driver.find_element(by=By.XPATH, value= | |||||
'/html/body/div/div[1]/div/div/div[2]/div[3]/div/ul/li[13]/a').get_attribute('href') | |||||
if link == "": | |||||
raise NoSuchElementException | |||||
try: | |||||
driver.get(link) | |||||
except: | |||||
driver.refresh() | |||||
html = driver.page_source | |||||
savePage(html, link) | |||||
count += 1 | |||||
except NoSuchElementException: | |||||
has_next_page = False | |||||
except Exception as e: | |||||
print(link, e) | |||||
i += 1 | |||||
# finalTime = time.time() | |||||
# print finalTime - initialTime | |||||
input("Crawling ThiefWorld forum done sucessfully. Press ENTER to continue\n") | |||||
# Returns 'True' if the link is a description link | |||||
#@param: url of any url crawled | |||||
#return: true if is a description page, false if not | |||||
def isDescriptionLink(url): | |||||
if 'product' in url: | |||||
return True | |||||
return False | |||||
# Returns True if the link is a listingPage link | |||||
#@param: url of any url crawled | |||||
#return: true if is a Listing page, false if not | |||||
def isListingLink(url): | |||||
if 'catalog' in url: | |||||
return True | |||||
return False | |||||
# calling the parser to define the links, the html is the url of a link from the list of interested link list | |||||
#@param: link from interested link list ie. getInterestingLinks() | |||||
#return: list of description links that should be crawled through | |||||
def productPages(html): | |||||
soup = BeautifulSoup(html, "html.parser") | |||||
return thiefworld_links_parser(soup) | |||||
# Drop links that "signout" | |||||
# def isSignOut(url): | |||||
# #absURL = urlparse.urljoin(url.base_url, url.url) | |||||
# if 'signout' in url.lower() or 'logout' in url.lower(): | |||||
# return True | |||||
# | |||||
# return False | |||||
def crawler(): | |||||
startCrawling() | |||||
# print("Crawling and Parsing BestCardingWorld .... DONE!") |
@ -0,0 +1,291 @@ | |||||
__author__ = 'DarkWeb' | |||||
# Here, we are importing the auxiliary functions to clean or convert data | |||||
from MarketPlaces.Utilities.utilities import * | |||||
# Here, we are importing BeautifulSoup to search through the HTML tree | |||||
from bs4 import BeautifulSoup | |||||
#parses description pages, so takes html pages of description pages using soup object, and parses it for info it needs | |||||
#stores info it needs in different lists, these lists are returned after being organized | |||||
#@param: soup object looking at html page of description page | |||||
#return: 'row' that contains a variety of lists that each hold info on the description page | |||||
def darkfox_description_parser(soup): | |||||
# Fields to be parsed | |||||
name = "-1" # 0 Product_Name | |||||
describe = "-1" # 1 Product_Description | |||||
lastSeen = "-1" # 2 Product_LastViewDate | |||||
rules = "-1" # 3 NOT USED ... | |||||
CVE = "-1" # 4 Product_CVE_Classification (Common Vulnerabilities and Exposures) | |||||
MS = "-1" # 5 Product_MS_Classification (Microsoft Security) | |||||
review = "-1" # 6 Product_Number_Of_Reviews | |||||
category = "-1" # 7 Product_Category | |||||
shipFrom = "-1" # 8 Product_ShippedFrom | |||||
shipTo = "-1" # 9 Product_ShippedTo | |||||
left = "-1" # 10 Product_QuantityLeft | |||||
escrow = "-1" # 11 Vendor_Warranty | |||||
terms = "-1" # 12 Vendor_TermsAndConditions | |||||
vendor = "-1" # 13 Vendor_Name | |||||
sold = "-1" # 14 Product_QuantitySold | |||||
addDate = "-1" # 15 Product_AddedDate | |||||
available = "-1" # 16 NOT USED ... | |||||
endDate = "-1" # 17 NOT USED ... | |||||
BTC = "-1" # 18 Product_BTC_SellingPrice | |||||
USD = "-1" # 19 Product_USD_SellingPrice | |||||
rating = "-1" # 20 Vendor_Rating | |||||
success = "-1" # 21 Vendor_Successful_Transactions | |||||
EURO = "-1" # 22 Product_EURO_SellingPrice | |||||
# Finding Product Name | |||||
name = soup.find('h1').text | |||||
name = name.replace('\n', ' ') | |||||
name = name.replace(",", "") | |||||
name = name.strip() | |||||
# Finding Vendor | |||||
vendor = soup.find('h3').find('a').text.strip() | |||||
# Finding Vendor Rating | |||||
rating = soup.find('span', {'class': "tag is-dark"}).text.strip() | |||||
# Finding Successful Transactions | |||||
success = soup.find('h3').text | |||||
success = success.replace("Vendor: ", "") | |||||
success = success.replace(vendor, "") | |||||
success = success.replace("(", "") | |||||
success = success.replace(")", "") | |||||
success = success.strip() | |||||
bae = soup.find('div', {'class': "box"}).find_all('ul') | |||||
# Finding Prices | |||||
USD = bae[1].find('strong').text.strip() | |||||
li = bae[2].find_all('li') | |||||
# Finding Escrow | |||||
escrow = li[0].find('span', {'class': "tag is-dark"}).text.strip() | |||||
# Finding the Product Category | |||||
category = li[1].find('span', {'class': "tag is-dark"}).text.strip() | |||||
# Finding the Product Quantity Available | |||||
left = li[3].find('span', {'class': "tag is-dark"}).text.strip() | |||||
# Finding Number Sold | |||||
sold = li[4].find('span', {'class': "tag is-dark"}).text.strip() | |||||
li = bae[3].find_all('li') | |||||
# Finding Shipment Information (Origin) | |||||
if "Ships from:" in li[-2].text: | |||||
shipFrom = li[-2].text | |||||
shipFrom = shipFrom.replace("Ships from: ", "") | |||||
# shipFrom = shipFrom.replace(",", "") | |||||
shipFrom = shipFrom.strip() | |||||
# Finding Shipment Information (Destination) | |||||
shipTo = li[-1].find('div', {'title': "List of countries is scrollable"}).text | |||||
shipTo = shipTo.replace("Ships to: ", "") | |||||
shipTo = shipTo.strip() | |||||
if "certain countries" in shipTo: | |||||
countries = "" | |||||
tags = li[-1].find_all('span', {'class': "tag"}) | |||||
for tag in tags: | |||||
country = tag.text.strip() | |||||
countries += country + ", " | |||||
shipTo = countries.strip(", ") | |||||
# Finding the Product description | |||||
describe = soup.find('div', {'class': "pre-line"}).text | |||||
describe = describe.replace("\n", " ") | |||||
describe = describe.strip() | |||||
'''# Finding the Number of Product Reviews | |||||
tag = soup.findAll(text=re.compile('Reviews')) | |||||
for index in tag: | |||||
reviews = index | |||||
par = reviews.find('(') | |||||
if par >=0: | |||||
reviews = reviews.replace("Reviews (","") | |||||
reviews = reviews.replace(")","") | |||||
reviews = reviews.split(",") | |||||
review = str(abs(int(reviews[0])) + abs(int(reviews[1]))) | |||||
else : | |||||
review = "-1"''' | |||||
# Searching for CVE and MS categories | |||||
cve = soup.findAll(text=re.compile('CVE-\d{4}-\d{4}')) | |||||
if cve: | |||||
CVE = " " | |||||
for idx in cve: | |||||
CVE += (idx) | |||||
CVE += " " | |||||
CVE = CVE.replace(',', ' ') | |||||
CVE = CVE.replace('\n', '') | |||||
ms = soup.findAll(text=re.compile('MS\d{2}-\d{3}')) | |||||
if ms: | |||||
MS = " " | |||||
for im in ms: | |||||
MS += (im) | |||||
MS += " " | |||||
MS = MS.replace(',', ' ') | |||||
MS = MS.replace('\n', '') | |||||
# Populating the final variable (this should be a list with all fields scraped) | |||||
row = (name, describe, lastSeen, rules, CVE, MS, review, category, shipFrom, shipTo, left, escrow, terms, vendor, | |||||
sold, addDate, available, endDate, BTC, USD, rating, success, EURO) | |||||
# Sending the results | |||||
return row | |||||
#parses listing pages, so takes html pages of listing pages using soup object, and parses it for info it needs | |||||
#stores info it needs in different lists, these lists are returned after being organized | |||||
#@param: soup object looking at html page of listing page | |||||
#return: 'row' that contains a variety of lists that each hold info on the listing page | |||||
def darkfox_listing_parser(soup): | |||||
# Fields to be parsed | |||||
nm = 0 # Total_Products (Should be Integer) | |||||
mktName = "DarkFox" # 0 Marketplace_Name | |||||
name = [] # 1 Product_Name | |||||
CVE = [] # 2 Product_CVE_Classification (Common Vulnerabilities and Exposures) | |||||
MS = [] # 3 Product_MS_Classification (Microsoft Security) | |||||
category = [] # 4 Product_Category | |||||
describe = [] # 5 Product_Description | |||||
escrow = [] # 6 Vendor_Warranty | |||||
views = [] # 7 Product_Number_Of_Views | |||||
reviews = [] # 8 Product_Number_Of_Reviews | |||||
addDate = [] # 9 Product_AddDate | |||||
lastSeen = [] # 10 Product_LastViewDate | |||||
BTC = [] # 11 Product_BTC_SellingPrice | |||||
USD = [] # 12 Product_USD_SellingPrice | |||||
EURO = [] # 13 Product_EURO_SellingPrice | |||||
sold = [] # 14 Product_QuantitySold | |||||
qLeft =[] # 15 Product_QuantityLeft | |||||
shipFrom = [] # 16 Product_ShippedFrom | |||||
shipTo = [] # 17 Product_ShippedTo | |||||
vendor = [] # 18 Vendor | |||||
rating = [] # 19 Vendor_Rating | |||||
success = [] # 20 Vendor_Successful_Transactions | |||||
href = [] # 23 Product_Links (Urls) | |||||
listing = soup.findAll('div', {"class": "card"}) | |||||
# Populating the Number of Products | |||||
nm = len(listing) | |||||
for a in listing: | |||||
bae = a.findAll('a', href=True) | |||||
# Adding the url to the list of urls | |||||
link = bae[0].get('href') | |||||
link = cleanLink(link) | |||||
href.append(link) | |||||
# Finding the Product | |||||
product = bae[1].find('p').text | |||||
product = product.replace('\n', ' ') | |||||
product = product.replace(",", "") | |||||
product = product.replace("...", "") | |||||
product = product.strip() | |||||
name.append(product) | |||||
bae = a.find('div', {'class': "media-content"}).find('div').find_all('div') | |||||
if len(bae) >= 5: | |||||
# Finding Prices | |||||
price = bae[0].text | |||||
ud = price.replace(" USD", " ") | |||||
# u = ud.replace("$","") | |||||
u = ud.replace(",", "") | |||||
u = u.strip() | |||||
USD.append(u) | |||||
# bc = (prc[1]).strip(' BTC') | |||||
# BTC.append(bc) | |||||
# Finding the Vendor | |||||
vendor_name = bae[1].find('a').text | |||||
vendor_name = vendor_name.replace(",", "") | |||||
vendor_name = vendor_name.strip() | |||||
vendor.append(vendor_name) | |||||
# Finding the Category | |||||
cat = bae[2].find('small').text | |||||
cat = cat.replace("Category: ", "") | |||||
cat = cat.replace(",", "") | |||||
cat = cat.strip() | |||||
category.append(cat) | |||||
# Finding Number Sold and Quantity Left | |||||
num = bae[3].text | |||||
num = num.replace("Sold: ", "") | |||||
num = num.strip() | |||||
sold.append(num) | |||||
quant = bae[4].find('small').text | |||||
quant = quant.replace("In stock: ", "") | |||||
quant = quant.strip() | |||||
qLeft.append(quant) | |||||
# Finding Successful Transactions | |||||
freq = bae[1].text | |||||
freq = freq.replace(vendor_name, "") | |||||
freq = re.sub(r'Vendor Level \d+', "", freq) | |||||
freq = freq.replace("(", "") | |||||
freq = freq.replace(")", "") | |||||
freq = freq.strip() | |||||
success.append(freq) | |||||
# Searching for CVE and MS categories | |||||
cve = a.findAll(text=re.compile('CVE-\d{4}-\d{4}')) | |||||
if not cve: | |||||
cveValue="-1" | |||||
else: | |||||
cee = " " | |||||
for idx in cve: | |||||
cee += (idx) | |||||
cee += " " | |||||
cee = cee.replace(',', ' ') | |||||
cee = cee.replace('\n', '') | |||||
cveValue=cee | |||||
CVE.append(cveValue) | |||||
ms = a.findAll(text=re.compile('MS\d{2}-\d{3}')) | |||||
if not ms: | |||||
MSValue="-1" | |||||
else: | |||||
me = " " | |||||
for im in ms: | |||||
me += (im) | |||||
me += " " | |||||
me = me.replace(',', ' ') | |||||
me = me.replace('\n', '') | |||||
MSValue=me | |||||
MS.append(MSValue) | |||||
# Populate the final variable (this should be a list with all fields scraped) | |||||
return organizeProducts(mktName, nm, name, CVE, MS, category, describe, escrow, views, reviews, addDate, lastSeen, | |||||
BTC, USD, EURO, qLeft, shipFrom, shipTo, vendor, rating, success, sold, href) | |||||
#called by the crawler to get description links on a listing page | |||||
#@param: beautifulsoup object that is using the correct html page (listing page) | |||||
#return: list of description links from a listing page | |||||
def thiefworld_links_parser(soup): | |||||
# Returning all links that should be visited by the Crawler | |||||
href = [] | |||||
listing = soup.find('div', {"class": "row tile__list tileitems_filter pad15 tileproduct__list"}).findAll('div', {"class": "desc"}) | |||||
for a in listing: | |||||
bae = a.find('div', {"class": "title"}).find('a', href=True) | |||||
link = bae['href'] | |||||
href.append(link) | |||||
return href |
@ -0,0 +1,14 @@ | |||||
[TOR] | |||||
firefox_binary_path = C:\Users\calsyslab\Desktop\Tor Browser\Browser\firefox.exe | |||||
firefox_profile_path = C:\Users\calsyslab\Desktop\Tor Browser\Browser\TorBrowser\Data\Browser\profile.default | |||||
geckodriver_path = C:\Users\calsyslab\Projects\dw_pipeline_test\selenium\geckodriver.exe | |||||
[Project] | |||||
project_directory = C:\Users\calsyslab\Projects\dw_pipeline_test | |||||
shared_folder = \\VBoxSvr\VM_Files_(shared) | |||||
[PostgreSQL] | |||||
ip = localhost | |||||
username = postgres | |||||
password = password | |||||
database = darkweb_markets_forums |