Browse Source

Forums and Markets status.

main
ericssonmarin-cpp 1 year ago
parent
commit
9fca859758
9 changed files with 70 additions and 17 deletions
  1. +1
    -1
      .idea/DW_Pipeline_Test.iml
  2. +1
    -1
      .idea/misc.xml
  3. +23
    -0
      Forums/DB_Connection/db_connection.py
  4. +1
    -8
      Forums/Initialization/forumsList.txt
  5. +6
    -0
      Forums/Initialization/prepare_parser.py
  6. +23
    -0
      MarketPlaces/DB_Connection/db_connection.py
  7. +1
    -1
      MarketPlaces/Initialization/marketsList.txt
  8. +6
    -0
      MarketPlaces/Initialization/prepare_parser.py
  9. +8
    -6
      setup.ini

+ 1
- 1
.idea/DW_Pipeline_Test.iml View File

@ -2,7 +2,7 @@
<module type="PYTHON_MODULE" version="4"> <module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" /> <content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="C:\Users\calsyslab\anaconda3" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="C:\Users\santanamarin\Anaconda3" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
</module> </module>

+ 1
- 1
.idea/misc.xml View File

@ -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:\Users\calsyslab\anaconda3" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="C:\Users\santanamarin\Anaconda3" project-jdk-type="Python SDK" />
</project> </project>

+ 23
- 0
Forums/DB_Connection/db_connection.py View File

@ -484,6 +484,24 @@ def create_posts(cur, row, forumId, topicId):
'dateinserted_post': row[8], 'dateinserted_post': row[8],
'postId': postId}) 'postId': postId})
def create_status(cur, forumId, date, status):
date = datetime.strptime(date, "%m%d%Y")
# checking if status already exists
sql = "select * from forums_status where forum_id = %(forum_id)s and date_inserted = %(date_inserted)s"
cur.execute(sql, {'forum_id': forumId, 'date_inserted': date})
recset = cur.fetchall()
if recset:
sql = "Update forums_status set status = %(status)s where forum_id = %(forum_id)s and date_inserted = %(date_inserted)s"
recset = {'status': status, 'forum_id': forumId, 'date_inserted': date}
else:
sql = "Insert into forums_status (forum_id, date_inserted, status) Values (%s, %s, %s)"
recset = [forumId, date, status]
cur.execute(sql, recset)
def create_database(cur, con): def create_database(cur, con):
try: try:
@ -496,6 +514,11 @@ def create_database(cur, con):
sql = "create unique index unique_forum ON forums USING btree (name_forum ASC NULLS LAST)" sql = "create unique index unique_forum ON forums USING btree (name_forum ASC NULLS LAST)"
cur.execute(sql) cur.execute(sql)
sql = "Create table forums_status (forum_id integer NOT NULL, date_inserted date NOT NULL, status bit(1) NOT NULL, " \
"CONSTRAINT forums_log_pkey PRIMARY KEY (forum_id, date_inserted), " \
"CONSTRAINT forums_fk FOREIGN KEY (forum_id) REFERENCES forums (forum_id))"
cur.execute(sql)
sql = "create table users (user_id integer NOT NULL, forum_id integer NOT NULL, name_user character varying(" \ sql = "create table users (user_id integer NOT NULL, forum_id integer NOT NULL, name_user character varying(" \
"255) NOT NULL, status_user character varying(255) null, reputation_user character varying(255) null, " \ "255) NOT NULL, status_user character varying(255) null, reputation_user character varying(255) null, " \
"interest_user character varying(5000) null, signature_user character varying(1000) null, " \ "interest_user character varying(5000) null, signature_user character varying(1000) null, " \


+ 1
- 8
Forums/Initialization/forumsList.txt View File

@ -1,8 +1 @@
Altenens
BestCardingWorld
Cardingleaks
CryptBB
HiddenAnswers
Libre
OnniForums
Procrax
BestCardingWorld

+ 6
- 0
Forums/Initialization/prepare_parser.py View File

@ -341,6 +341,12 @@ def new_parse(forum, url, createLog):
# move listing files of completed folder # move listing files of completed folder
move_file(listingFile, createLog, logFile) move_file(listingFile, createLog, logFile)
# registering the current forum status (up/down) in the database
forumId = verifyForum(cur, forum)
if (forumId > 0):
create_status(cur, forumId, CURRENT_DATE, '1' if len(listings) > 0 else '0')
con.commit()
if createLog: if createLog:
logFile.close() logFile.close()


+ 23
- 0
MarketPlaces/DB_Connection/db_connection.py View File

@ -401,6 +401,24 @@ def create_items(cur, row, marketId, vendorId):
return itemId return itemId
def create_status(cur, marketId, date, status):
date = datetime.strptime(date, "%m%d%Y")
# checking if status already exists
sql = "select * from marketplaces_status where market_id = %(market_id)s and date_inserted = %(date_inserted)s"
cur.execute(sql, {'market_id': marketId, 'date_inserted': date})
recset = cur.fetchall()
if recset:
sql = "Update marketplaces_status set status = %(status)s where market_id = %(market_id)s and date_inserted = %(date_inserted)s"
recset = {'status': status, 'market_id': marketId, 'date_inserted': date}
else:
sql = "Insert into marketplaces_status (market_id, date_inserted, status) Values (%s, %s, %s)"
recset = [marketId, date, status]
cur.execute(sql, recset)
def create_database(cur, con): def create_database(cur, con):
try: try:
@ -413,6 +431,11 @@ def create_database(cur, con):
sql = "create unique index unique_market ON marketplaces USING btree (name_market ASC NULLS LAST)" sql = "create unique index unique_market ON marketplaces USING btree (name_market ASC NULLS LAST)"
cur.execute(sql) cur.execute(sql)
sql = "Create table marketplaces_status (market_id integer NOT NULL, date_inserted date NOT NULL, status bit(1) NOT NULL, " \
"CONSTRAINT marketplaces_log_pkey PRIMARY KEY (market_id, date_inserted), " \
"CONSTRAINT marketplaces_fk FOREIGN KEY (market_id) REFERENCES marketplaces (market_id))"
cur.execute(sql)
sql = "create table vendors(vendor_id integer not null, market_id integer not null, name_vendor character " \ sql = "create table vendors(vendor_id integer not null, market_id integer not null, name_vendor character " \
"varying(255) not null, rating_vendor character varying(255), successfultransactions_vendor integer " \ "varying(255) not null, rating_vendor character varying(255), successfultransactions_vendor integer " \
"null, image_vendor character varying(10000000) null, dateinserted_vendor timestamp(6) with time zone not null, " \ "null, image_vendor character varying(10000000) null, dateinserted_vendor timestamp(6) with time zone not null, " \


+ 1
- 1
MarketPlaces/Initialization/marketsList.txt View File

@ -1 +1 @@
ThiefWorld
ViceCity

+ 6
- 0
MarketPlaces/Initialization/prepare_parser.py View File

@ -363,6 +363,12 @@ def new_parse(marketPlace, url, createLog):
# move listing files of completed folder # move listing files of completed folder
move_file(listingFile, createLog, logFile) move_file(listingFile, createLog, logFile)
# registering the current forum status (up/down) in the database
marketId = verifyMarketPlace(cur, marketPlace)
if (marketId > 0):
create_status(cur, marketId, CURRENT_DATE, '1' if len(listings) > 0 else '0')
con.commit()
if createLog: if createLog:
logFile.close() logFile.close()


+ 8
- 6
setup.ini View File

@ -1,17 +1,19 @@
[TOR] [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:\calsyslab\Project\dw_pipeline_test\selenium\geckodriver.exe
firefox_binary_path = C:\Users\santanamarin\OneDrive - Cal Poly Pomona\Desktop\Tor Browser\Browser\firefox.exe
firefox_profile_path = C:\Users\santanamarin\OneDrive - Cal Poly Pomona\Desktop\Tor Browser\Browser\TorBrowser\Data\Browser\profile.default
geckodriver_path = E:\Faculty\CSPUP\ResearchProjects\dw_pipeline_test\selenium\geckodriver.exe
"C:\Users\santanamarin\OneDrive - Cal Poly Pomona\Desktop\Tor Browser\Browser\firefox.exe"
[Project] [Project]
project_directory = C:\calsyslab\Project\dw_pipeline_test
shared_folder = \\VBoxSvr\Shared
project_directory = E:\Faculty\CSPUP\ResearchProjects\dw_pipeline_test
shared_folder = E:\Faculty\CSPUP\ResearchProjects\dw_pipeline_test
[PostgreSQL] [PostgreSQL]
ip = localhost ip = localhost
username = postgres username = postgres
password = password
password = 123
database = darkweb_markets_forums database = darkweb_markets_forums
[Encryption] [Encryption]

Loading…
Cancel
Save