Guest User

Untitled

a guest
Jul 16th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.37 KB | None | 0 0
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3.  
  4. #include <QMainWindow>
  5.  
  6. namespace Ui {
  7. class MainWindow;
  8. }
  9.  
  10. class MainWindow : public QMainWindow
  11. {
  12. Q_OBJECT
  13.  
  14. public:
  15. explicit MainWindow(QWidget *parent = 0);
  16. ~MainWindow();
  17.  
  18. private slots:
  19. void Queud() ;
  20.  
  21. void on_FindButton_clicked();
  22.  
  23. protected:
  24. void closeEvent(QCloseEvent *e) ;
  25.  
  26. private:
  27. Ui::MainWindow *ui;
  28. QTimer *timer ;
  29. };
  30.  
  31. #endif // MAINWINDOW_H
  32.  
  33. #ifndef SCANTHREAD_H
  34. #define SCANTHREAD_H
  35. #include <QtCore>
  36.  
  37. class ScanThread :public QThread
  38. {
  39. public:
  40. ScanThread();
  41. void run() ;
  42. };
  43.  
  44. #endif // SCANTHREAD_H
  45.  
  46. #include "mainwindow.h"
  47. #include "scanthread.h"
  48. #include <QApplication>
  49.  
  50. int main(int argc, char *argv[])
  51. {
  52. QApplication a(argc, argv);
  53. MainWindow w;
  54. w.show();
  55.  
  56. /* start that thread */
  57. ScanThread sThread ;
  58. sThread.start() ;
  59.  
  60. return a.exec();
  61. }
  62.  
  63. #include "mainwindow.h"
  64. #include "ui_mainwindow.h"
  65. #include "scanthread.h"
  66. #include <QMessageBox>
  67. #include <QStorageInfo>
  68. #include <QDirIterator>
  69. #include <QFileDialog>
  70. #include <QTimer>
  71. #include <QDebug>
  72. #include <QtCore>
  73. #include <QString>
  74. #include <QCloseEvent>
  75.  
  76. using namespace std ;
  77.  
  78. QString Read_CurrentPath ;
  79. QString Read_Suspect ;
  80. QString Last_Suspect ;
  81. QString ThisPath ;
  82. QString Find_Item ;
  83. float LoadBar = 0 ;
  84.  
  85. MainWindow::MainWindow(QWidget *parent) :
  86. QMainWindow(parent),
  87. ui(new Ui::MainWindow)
  88. {
  89. /* launch timer to update ui */
  90. timer = new QTimer(this);
  91. connect(timer, SIGNAL(timeout()), this, SLOT(Queud()));
  92. timer->start(1000);
  93.  
  94. ui->setupUi(this);
  95. }
  96.  
  97. MainWindow::~MainWindow()
  98. {
  99. delete ui;
  100. }
  101.  
  102. void MainWindow::Queud()
  103. {
  104.  
  105. /* looking for list state wich word is beign tested */
  106. QFile ReadLog_Count("ListState.temp") ;
  107.  
  108. if(ReadLog_Count.open(QFile::ReadOnly | QFile::Text))
  109. {
  110. QTextStream in(&ReadLog_Count) ;
  111.  
  112. in >> LoadBar ;
  113.  
  114. //qDebug() << LoadBar ;
  115. }
  116. ReadLog_Count.flush() ;
  117. ReadLog_Count.close() ;
  118.  
  119. /* looking wich current file is beign tested */
  120. QFile ReadLog_CurrentPath("CurrentP.temp") ;
  121.  
  122. if(ReadLog_CurrentPath.open(QFile::ReadOnly | QFile::Text))
  123. {
  124. QTextStream in(&ReadLog_CurrentPath) ;
  125.  
  126. Read_CurrentPath = in .readLine();
  127.  
  128. //qDebug() << read_temp ;
  129. }
  130. ReadLog_CurrentPath.flush() ;
  131. ReadLog_CurrentPath.close() ;
  132.  
  133. QFile ReadLog_VirusFound("VFound.temp") ;
  134.  
  135. if(ReadLog_VirusFound.open(QFile::ReadOnly | QFile::Text))
  136. {
  137. QTextStream in(&ReadLog_VirusFound) ;
  138.  
  139. Read_Suspect = in.readLine() ;
  140.  
  141. if(Read_Suspect == Last_Suspect)
  142. {
  143.  
  144. }
  145. else
  146. {
  147. ui->VirusView->addItem(Read_Suspect);
  148.  
  149. }
  150. Last_Suspect = Read_Suspect ;
  151. Read_Suspect = "" ;
  152.  
  153. }
  154. ReadLog_VirusFound.flush() ;
  155. ReadLog_VirusFound.close() ;
  156.  
  157. LoadBar = (LoadBar / 235) * 100 ;
  158.  
  159. if(Read_CurrentPath == "")
  160. {
  161. /* theres an error the path caint be empty */
  162. }
  163. else
  164. {
  165. /* receive the signal #1313 mean boss i finish my work */
  166. if(Read_CurrentPath == "#1313") //#1313 dev code to manually signal that the scans as been completed
  167. {
  168. //qDebug() << Read_CurrentPath ;
  169. LoadBar = 0 ;
  170. ui->Path_Status->setText("Scan Complete") ;
  171. ui->LoadBar->setValue(0) ;
  172.  
  173. system("del VFound.temp") ;
  174. system("del CurrentP.temp") ;
  175. timer->stop() ;
  176. }
  177. else
  178. {
  179. ui->Path_Status->setText(Read_CurrentPath) ;
  180. }
  181. }
  182.  
  183. /* update load bar as it needed */
  184. if(LoadBar == 0)
  185. {
  186.  
  187. }
  188. else
  189. {
  190. ui->LoadBar->setValue(LoadBar);
  191. }
  192.  
  193. /* unlock list & Find when scan is complete */
  194. if(Read_CurrentPath == "#1313")
  195. {
  196. ui->VirusView->setEnabled(true) ;
  197. ui->FindButton->setEnabled(true) ;
  198. }
  199.  
  200. }
  201.  
  202. /* close program handling */
  203. void MainWindow::closeEvent(QCloseEvent *e)
  204. {
  205. /* can close normally */
  206. if(Read_CurrentPath == "#1313")
  207. {
  208. timer->stop() ;
  209. e->accept() ;
  210. }
  211. /* dont close the program untill scan complete its not a --->bloatware<--- */
  212. else
  213. {
  214. QMessageBox MSG ;
  215. MSG.setText("You are about to close ,the scan is incomplete.n Leaving while the scan still running can occur errors n please wait..");
  216. MSG.exec() ;
  217.  
  218.  
  219. e->ignore() ;
  220. }
  221.  
  222. }
  223.  
  224.  
  225. /* when clicked show the path of the "detected" virus */
  226. void MainWindow::on_FindButton_clicked()
  227. {
  228.  
  229. Find_Item = ui->VirusView->currentItem()->text() ;
  230.  
  231. qDebug() << " i want to find :: " + Find_Item ;
  232.  
  233. QStorageInfo storage_name = QStorageInfo::root() ;
  234. QString Root_ = storage_name.rootPath() ;
  235.  
  236. QDirIterator Find_ItemPath(Root_, QDirIterator::Subdirectories | QDirIterator::FollowSymlinks) ;
  237.  
  238. do
  239. {
  240.  
  241. ThisPath = QString (Find_ItemPath.next()) ;
  242.  
  243. if(ThisPath.contains(Find_Item) == true)
  244. {
  245. qDebug() << "I have Found the Path of the threat in :: " + ThisPath ;
  246.  
  247. QMessageBox MSG ;
  248. MSG.setText("The Threat Path is n" + ThisPath) ;
  249. MSG.exec() ;
  250.  
  251. break ;
  252. }
  253.  
  254. }while(Find_ItemPath.hasNext()) ;
  255.  
  256. }
  257.  
  258. #include "scanthread.h"
  259. #include "mainwindow.h"
  260. #include "ui_mainwindow.h"
  261. #include <QDir>
  262. #include <QtCore>
  263. #include <QDebug>
  264.  
  265. QString Root ;
  266. QString Path ;
  267. QString Match ;
  268. QString BlackList = ":/BlackList.txt" ;
  269.  
  270. ScanThread::ScanThread()
  271. {
  272.  
  273. }
  274.  
  275. void ScanThread::run()
  276. {
  277.  
  278. /* Getting storage name C:/ D:/ E:/ etc..*/
  279. QStorageInfo storage_name = QStorageInfo::root() ;
  280. Root = storage_name.rootPath() ;
  281. /* change Root for debug test to e.g C:/Users/Client/Desktop */
  282. QDirIterator Load_Path(Root, QDirIterator::Subdirectories | QDirIterator::FollowSymlinks) ;
  283.  
  284. /* scannning all file in all possible path of the principal dir */
  285. do
  286. {
  287.  
  288. QFile Write_Path("path.temp") ;
  289.  
  290. if(Write_Path.open(QFile::WriteOnly | QFile::Text | QFile::Append))
  291. {
  292. QTextStream out(&Write_Path) ;
  293.  
  294. Path = QString (Load_Path.next()) ;
  295. qDebug() << Load_Path.fileName() ;
  296.  
  297. out << Load_Path.fileName() << endl ;
  298.  
  299. //qDebug() << "im looking for enviroment " << Path ;
  300. }
  301. Write_Path.flush() ;
  302. Write_Path.close() ;
  303.  
  304. }while(Load_Path.hasNext()) ;
  305.  
  306. /* setuping the scan */
  307. //qDebug() << "Trying to setup the scan " ;
  308.  
  309. QFile Read_Path("path.temp") ;
  310. QFile Read_Blacklist(BlackList) ;
  311.  
  312. if(Read_Path.open(QFile::ReadOnly | QFile::Text))
  313. {
  314. QTextStream in(&Read_Path) ;
  315.  
  316. /* read path.temp(contain all file) */
  317. //qDebug() << "Trying to read path.temp" ;
  318. while(!Read_Path.atEnd())
  319. {
  320. Scan:
  321. Path = in.readLine() ;
  322. if(Path == "")
  323. {
  324. goto EndScan ;
  325. }
  326. else
  327. {
  328. /* look for path one by one */
  329. QFile Logs_CurrentPath("CurrentP.temp") ;
  330.  
  331. if(Logs_CurrentPath.open(QFile::WriteOnly | QFile::Text))
  332. {
  333. QTextStream out(&Logs_CurrentPath) ;
  334.  
  335. out << Path ;
  336. }
  337. Logs_CurrentPath.flush() ;
  338. Logs_CurrentPath.close() ;
  339. }
  340.  
  341. /* open blacklist from ressource */
  342. //qDebug() << "Trying to open the blacklist " ;
  343.  
  344.  
  345. if(Read_Blacklist.open(QFile::ReadOnly | QFile::Text))
  346. {
  347. /* compare path file and words in blacklist */
  348. QTextStream in(&Read_Blacklist) ;
  349. for(int i = 0 ; i < 235 ; i ++)
  350. {
  351. Match = in.readLine() ;
  352.  
  353. QFile Logs_ListState("ListState.temp") ;
  354.  
  355. if(Logs_ListState.open(QFile::WriteOnly | QFile::Text))
  356. {
  357. QTextStream out(&Logs_ListState) ;
  358. out << i ;
  359. }
  360. Logs_ListState.flush() ;
  361. Logs_ListState.close() ;
  362.  
  363. // qDebug() << "Scanning for potential threat" ;
  364. // qDebug() << Match ;
  365. // qDebug() << Path ;
  366.  
  367. if(Path.contains(Match , Qt::CaseSensitive) == true)
  368. {
  369. /* theres a threat do something */
  370. //qDebug() << "Virus found in " + Path ;
  371. QFile Logs_VirusFound("VFound.temp") ;
  372.  
  373. if(Logs_VirusFound.open(QFile::WriteOnly | QFile::Text))
  374. {
  375. QTextStream out(&Logs_VirusFound) ;
  376.  
  377. out << Path ;
  378. //qDebug() << Path ;
  379. //qDebug() << Match ;
  380.  
  381. }
  382. Logs_VirusFound.flush() ;
  383. Logs_VirusFound.close() ;
  384. ScanThread::sleep(1) ;
  385. //int pause = 20000 ;
  386. //for(int i = 0 ; i < pause ; i++)
  387. //{
  388. /* just make sure that the program can read it before it get overwrited */
  389. //qDebug() << "wait" ;
  390. //}
  391. }
  392.  
  393. }
  394. }
  395. Read_Blacklist.flush() ;
  396. Read_Blacklist.close() ;
  397. goto Scan ;
  398. }
  399.  
  400. /* end the scan once Read_Path is at end */
  401. if(Read_Path.atEnd())
  402. {
  403. EndScan:
  404. //qDebug() << "Scan Complete ";
  405.  
  406.  
  407. Read_Path.flush() ;
  408. Read_Path.close() ;
  409.  
  410. QFile WriteEnd("CurrentP.temp") ;
  411.  
  412. if(WriteEnd.open(QFile::WriteOnly | QFile::Text))
  413. {
  414. QTextStream out(&WriteEnd) ;
  415.  
  416. out << "#1313" << endl ; //#1313 dev code to manually signal that the scans as been completed
  417. }
  418. WriteEnd.flush() ;
  419. WriteEnd.close() ;
  420.  
  421. system("del path.temp") ;
  422. system("del ListState.temp") ;
  423.  
  424. /* terminate thread */
  425. ScanThread::terminate() ;
  426. }
  427. }
  428. }
  429.  
  430. <?xml version="1.0" encoding="UTF-8"?>
  431. <ui version="4.0">
  432. <class>MainWindow</class>
  433. <widget class="QMainWindow" name="MainWindow">
  434. <property name="geometry">
  435. <rect>
  436. <x>0</x>
  437. <y>0</y>
  438. <width>659</width>
  439. <height>380</height>
  440. </rect>
  441. </property>
  442. <property name="minimumSize">
  443. <size>
  444. <width>659</width>
  445. <height>380</height>
  446. </size>
  447. </property>
  448. <property name="maximumSize">
  449. <size>
  450. <width>659</width>
  451. <height>380</height>
  452. </size>
  453. </property>
  454. <property name="windowTitle">
  455. <string>Pinfo</string>
  456. </property>
  457. <widget class="QWidget" name="centralWidget">
  458. <widget class="QLabel" name="label_2">
  459. <property name="geometry">
  460. <rect>
  461. <x>20</x>
  462. <y>10</y>
  463. <width>71</width>
  464. <height>16</height>
  465. </rect>
  466. </property>
  467. <property name="text">
  468. <string>Interrogating:</string>
  469. </property>
  470. </widget>
  471. <widget class="QLabel" name="Path_Status">
  472. <property name="geometry">
  473. <rect>
  474. <x>90</x>
  475. <y>10</y>
  476. <width>551</width>
  477. <height>16</height>
  478. </rect>
  479. </property>
  480. <property name="text">
  481. <string>Scanning environment.....</string>
  482. </property>
  483. </widget>
  484. <widget class="QPushButton" name="FindButton">
  485. <property name="enabled">
  486. <bool>false</bool>
  487. </property>
  488. <property name="geometry">
  489. <rect>
  490. <x>290</x>
  491. <y>350</y>
  492. <width>80</width>
  493. <height>21</height>
  494. </rect>
  495. </property>
  496. <property name="text">
  497. <string>Find on Pc</string>
  498. </property>
  499. </widget>
  500. <widget class="QWidget" name="layoutWidget">
  501. <property name="geometry">
  502. <rect>
  503. <x>20</x>
  504. <y>40</y>
  505. <width>621</width>
  506. <height>301</height>
  507. </rect>
  508. </property>
  509. <layout class="QVBoxLayout" name="verticalLayout">
  510. <item>
  511. <widget class="QProgressBar" name="LoadBar">
  512. <property name="value">
  513. <number>0</number>
  514. </property>
  515. </widget>
  516. </item>
  517. <item>
  518. <widget class="QListWidget" name="VirusView">
  519. <property name="enabled">
  520. <bool>false</bool>
  521. </property>
  522. </widget>
  523. </item>
  524. </layout>
  525. </widget>
  526. </widget>
  527. </widget>
  528. <layoutdefault spacing="6" margin="11"/>
  529. <resources/>
  530. <connections/>
  531. </ui>
  532.  
  533. AOM Trojan
  534. A97M
  535. Aardwolf
  536. Abal
  537. Abba
  538. Abbas
  539. Abraxas
  540. Absturz
  541. Absys
  542. Ache
  543. AcidRain
  544. AcidWarp
  545. Acula
  546. Acurev
  547. Acvt
  548. ADAF
  549. Adeni
  550. Adindi
  551. Adreim
  552. Adrenalin
  553. Adrenaline
  554. Adri
  555. ADsmile
  556. Worm
  557. ADDeliverer
  558. ADH
  559. Admagic
  560. AdPutHelper
  561. Binet
  562. Browext
  563. Cacb
  564. Cleanurl
  565. ContentDefend
  566. Controlthis
  567. ConvrtFilesFree
  568. Coolpp
  569. CouponAge
  570. CrimeWatch
  571. Cygo
  572. DealPly
  573. DriverTuneup
  574. DropSpam
  575. Ebon
  576. Edea
  577. FFinder
  578. Hotbar
  579. Iefeats
  580. IGetNet
  581. IntelliDownload
  582. ISearchHelpW
  583. ISMonitor
  584. KMGuide
  585. Kraddare
  586. KuwoMusic
  587. LampUpdate
  588. Lollipop
  589. Loudmo
  590. MidADdle
  591. Opencash
  592. PassShow
  593. Psic
  594. Ramdud
  595. Rcash
  596. Searchthisbiz
  597. SmartAllYes
  598. Soduisearch
  599. Sponsorbox
  600. SysAI
  601. Tginfo
  602. Toolgate
  603. WhistleHelp
  604. XPassmanager
  605. AdWhere
  606. AEP
  607. Aforia
  608. AFV
  609. AGA
  610. Agena
  611. Ailbone
  612. AIMpws
  613. AirCop
  614. Airdef
  615. Airwalker
  616. Aiwed
  617. Ajax
  618. Akill
  619. Alaeh
  620. Alaper
  621. Alar
  622. Alar
  623. Albania
  624. Albanian
  625. ALEV
  626. Alfons
  627. Alho
  628. Alicino
  629. Alphastrike
  630. Alphavirus
  631. ALS Kenilfe
  632. ALSetup
  633. Altx
  634. Jaring intended
  635. Aman
  636. Amanita
  637. Amoeba
  638. Amt
  639. Amuck
  640. Anad
  641. ANDR
  642. Andris
  643. Adflex
  644. Adload
  645. Bangcle
  646. Dumpplug
  647. Gaode
  648. GappII
  649. Goldeneagle
  650. Gonfu
  651. Gongxin
  652. Jztapp
  653. Kosat
  654. Minimob
  655. Mobidash
  656. Noiconads
  657. Quanzhifu
  658. Skypeads
  659. Smstracker
  660. Torsend
  661. TucySms
  662. Widdit
  663. Wifikill
  664. Xinyinhe
  665. ZZcollector
  666. Androide
  667. Andromeda
  668. Angera
  669. AnniVCS
  670. Annres
  671. Anony
  672. Anston
  673. Anthrax
  674. AntiArj
  675. Antiarj
  676. AntiArj
  677. AntiAVP
  678. AntiBase
  679. AntiBasic
  680. AntiCAD
  681. Anticheck
  682. Antichek
  683. AntiCMOS
  684. ANTICOM
  685. Antiem
  686. Antieta
  687. ANTIEXE
  688. Antifor
  689. AntiFort
  690. Antigus
  691. Antilamer
  692. AntiMit
  693. AntiMon
  694. AntiPascal
  695. Antipass
  696. Antipode
  697. AntiScan
  698. AntiSkol
  699. ANTIW
  700. AntiWin
  701. AoTaun
  702. Apadana
  703. APE
  704. APM
  705. APOC
  706. Apocalipse
  707. AppelSch
  708. Appelscha
  709. Arcobale
  710. ARCV
  711. Aref
  712. Areg
  713. Arequipa
  714. AreThree
  715. Arfav
  716. Argyle
  717. ArjDrop
  718. Arjworm
  719. Armageddon
  720. Armagedon
  721. Armen
  722. Armenia
  723. ARSON
  724. Arusiek
  725. Asahi
  726. ASBV
  727. Asch
  728. Asim
  729. Aslf
  730. Asmodeous
  731. Asmodeus
  732. ASMvirus
  733. Assassin
  734. Asscom
  735. ASStral
  736. Asterisk
  737. Astra
  738. AstraSYS
  739. Atas
  740. Atb
  741. ATB
  742. ATCORP
  743. Atenfor
  744. Atomant
  745. Atomant
  746. Augnight
  747. Aurea
  748. AusIH
  749. Auspar
  750. AussieBoy
  751. Aust
  752. AusTerm
  753. Austr
  754. AustralianTiny
  755. Autumnal
  756. Autur
  757. Avalgasil
  758. Avcs
  759. Avispa
  760. Avlanche
  761. Avvaddon
  762. AWME
  763. AWVCK
  764. Aximus
  765. Axypt
  766. Azatoth
  767. Azboo
Add Comment
Please, Sign In to add comment