From 2bf3e7447e92bc1914db8e917d67084b1b1237b8 Mon Sep 17 00:00:00 2001
From: Joshua <student.joshuaestrada@gmail.com>
Date: Fri, 4 Aug 2023 19:28:41 -0700
Subject: [PATCH] Uncommented Commented things that shouldve been uncommented.
 also added item rating in listing parser.

---
 MarketPlaces/HiddenMarket/crawler_selenium.py | 38 +++++++++----------
 MarketPlaces/HiddenMarket/parser.py           | 25 +++++++++---
 2 files changed, 38 insertions(+), 25 deletions(-)

diff --git a/MarketPlaces/HiddenMarket/crawler_selenium.py b/MarketPlaces/HiddenMarket/crawler_selenium.py
index 8a99400..c89d467 100644
--- a/MarketPlaces/HiddenMarket/crawler_selenium.py
+++ b/MarketPlaces/HiddenMarket/crawler_selenium.py
@@ -29,17 +29,17 @@ baseURL = 'http://mipx6eedtsvfgfcmbm3utjedgjez2w4dzjdrbhtd2mt3cicwhhzspxqd.onion
 
 # Opens Tor Browser, crawls the website
 def startCrawling():
-    # opentor()
+    opentor()
     marketName = getMKTName()
-    # driver = getAccess()
+    driver = getAccess()
 
-    # if driver != 'down':
-    #     try:
-    #         login(driver)
-    #         crawlForum(driver)
-    #     except Exception as e:
-    #         print(driver.current_url, e)
-    #     closetor(driver)
+    if driver != 'down':
+        try:
+            login(driver)
+            crawlForum(driver)
+        except Exception as e:
+            print(driver.current_url, e)
+        closetor(driver)
 
     new_parse(marketName, baseURL, False)
 
@@ -211,27 +211,27 @@ def getInterestedLinks():
     links = []
 
     # # Civil Software
-    # links.append('http://mipx6eedtsvfgfcmbm3utjedgjez2w4dzjdrbhtd2mt3cicwhhzspxqd.onion/category/civil_softwares')
+    links.append('http://mipx6eedtsvfgfcmbm3utjedgjez2w4dzjdrbhtd2mt3cicwhhzspxqd.onion/category/civil_softwares')
     # # Tutorials - Carding
-    # links.append('http://mipx6eedtsvfgfcmbm3utjedgjez2w4dzjdrbhtd2mt3cicwhhzspxqd.onion/category/carding')
+    links.append('http://mipx6eedtsvfgfcmbm3utjedgjez2w4dzjdrbhtd2mt3cicwhhzspxqd.onion/category/carding')
     # # Digital - Hacks
-    # links.append('http://mipx6eedtsvfgfcmbm3utjedgjez2w4dzjdrbhtd2mt3cicwhhzspxqd.onion/category/hacks')
+    links.append('http://mipx6eedtsvfgfcmbm3utjedgjez2w4dzjdrbhtd2mt3cicwhhzspxqd.onion/category/hacks')
     # Digital - Exploit Kit
-    # links.append('http://mipx6eedtsvfgfcmbm3utjedgjez2w4dzjdrbhtd2mt3cicwhhzspxqd.onion/category/exploit_kit')
+    links.append('http://mipx6eedtsvfgfcmbm3utjedgjez2w4dzjdrbhtd2mt3cicwhhzspxqd.onion/category/exploit_kit')
     # # 0Day
-    # links.append('http://mipx6eedtsvfgfcmbm3utjedgjez2w4dzjdrbhtd2mt3cicwhhzspxqd.onion/category/0day')
+    links.append('http://mipx6eedtsvfgfcmbm3utjedgjez2w4dzjdrbhtd2mt3cicwhhzspxqd.onion/category/0day')
     # Digital Forensics
-    # links.append('http://mipx6eedtsvfgfcmbm3utjedgjez2w4dzjdrbhtd2mt3cicwhhzspxqd.onion/category/digital_forensics')
+    links.append('http://mipx6eedtsvfgfcmbm3utjedgjez2w4dzjdrbhtd2mt3cicwhhzspxqd.onion/category/digital_forensics')
     # Tutorials - Mining
-    # links.append('http://mipx6eedtsvfgfcmbm3utjedgjez2w4dzjdrbhtd2mt3cicwhhzspxqd.onion/category/mining')
+    links.append('http://mipx6eedtsvfgfcmbm3utjedgjez2w4dzjdrbhtd2mt3cicwhhzspxqd.onion/category/mining')
     # Tutorials - Worms
-    # links.append('http://mipx6eedtsvfgfcmbm3utjedgjez2w4dzjdrbhtd2mt3cicwhhzspxqd.onion/category/worms')
+    links.append('http://mipx6eedtsvfgfcmbm3utjedgjez2w4dzjdrbhtd2mt3cicwhhzspxqd.onion/category/worms')
     # Tutorials - Viruses
     links.append('http://mipx6eedtsvfgfcmbm3utjedgjez2w4dzjdrbhtd2mt3cicwhhzspxqd.onion/category/viruses')
     # Tutorials - Trojans
-    # links.append('http://mipx6eedtsvfgfcmbm3utjedgjez2w4dzjdrbhtd2mt3cicwhhzspxqd.onion/category/trojans')
+    links.append('http://mipx6eedtsvfgfcmbm3utjedgjez2w4dzjdrbhtd2mt3cicwhhzspxqd.onion/category/trojans')
     # Tutorials - Botnets
-    # links.append('http://mipx6eedtsvfgfcmbm3utjedgjez2w4dzjdrbhtd2mt3cicwhhzspxqd.onion/category/botnets')
+    links.append('http://mipx6eedtsvfgfcmbm3utjedgjez2w4dzjdrbhtd2mt3cicwhhzspxqd.onion/category/botnets')
 
     return links
 
diff --git a/MarketPlaces/HiddenMarket/parser.py b/MarketPlaces/HiddenMarket/parser.py
index 375a0e4..8f77f9d 100644
--- a/MarketPlaces/HiddenMarket/parser.py
+++ b/MarketPlaces/HiddenMarket/parser.py
@@ -203,6 +203,19 @@ def hiddenmarket_listing_parser(soup):
         sale = tb[-2].text.strip()
         sold.append(sale)
 
+        # Finding Item Rating
+        if num == '0':
+            item_rating = '-1'
+        else:
+            item_rating = card.next_sibling.find('div', {'class': 'stats'}).find('div', {'class': "stars2"})
+            item_rating = item_rating.get('style')
+            item_rating = item_rating.replace("width:", "")
+            item_rating = item_rating.replace("%", "")
+            item_rating = (float(item_rating) * 5.0) / 100.0
+            item_rating = "{:.{}f}".format(item_rating, 2)
+        rating_item.append(item_rating)
+
+
         # Finding shipping info
         shipping = card.next_sibling.find('div', {'class': "shipping"}).text.split('>')
         # SHip from
@@ -213,12 +226,12 @@ def hiddenmarket_listing_parser(soup):
         shipTo.append(destination)
 
         # Finding description (site only shows partial description on listing pages)
-        description = card.next_sibling.find('div', {'class': "description"}).text
-        description = description.replace("\n", " ")
-        description = description.replace("\r", " ")
-        description = description.replace("-", " ")
-        description = description.strip()
-        describe.append(description)
+        # description = card.next_sibling.find('div', {'class': "description"}).text
+        # description = description.replace("\n", " ")
+        # description = description.replace("\r", " ")
+        # description = description.replace("-", " ")
+        # description = description.strip()
+        # describe.append(description)
 
         # Searching for CVE and MS categories
         cve = card.findAll(text=re.compile('CVE-\d{4}-\d{4}'))