WEB-Skript: Dateien automatisiert mit Virustotal prüfen lassen.

Moderator: MVogt

Post Reply
User avatar
Theo_Gottwald
Posts: 367
Joined: 03. Oct 2009, 08:57
Location: Herrenstr.11 * 76706 Dettenheim
Contact:

WEB-Skript: Dateien automatisiert mit Virustotal prüfen lassen.

Post by Theo_Gottwald » 02. Mar 2020, 15:49

WEB-Skripting hat sich in den letzten Jahren verändert.
Das Skript hier dient als Beispiel für ein solche WEB-Skript.
Dabei geht es einfach darum eine WEB-Site zu öffnen, Bedienhandlungen vorzunehmen,
das Ergebnis in einer Textdatei zu protokollieren.

War ursprünglich der INTERNET EXPLORER (IE) das Mittel der Wahl, so funktioniert der IE bei vielen aktuellen WEB-Sites nicht mehr.
Das Tool der Wahl ist dahermit dem MPR nun FIREFOX (FF) - ohnehin bei vielen Admins der Browser der Wahl.
Der FF lässt sich mit dem MPR/SPR gut automatisieren und so werden wir den FF hier verwenden, das bedeutet der FF muss installiert sein damit das Skript hier funktioniert.

Was tut das Skript?
---------------------------
Das Skript lädt alle Dateien die in einem Ordner (&Unterordner) sind zu Virustotal hoch,
und schreibt das Ergebnis (das Virustotal anzeigt) in eine neu erzeugte Text-Datei.

So kann man alle an einem Projekt beteiligten Dateien mal mit Virustotal prüfen lassen.
Das Skript kann als EXE-Datei kompiliert werden, die Textdatei mit dem Ergebnis wird in dem Verzeichnis
erzeugt, wo die Textdatei liegt. Natürlich funktioniert das Skript auch aus dem Editor - nur eben langsamer.

Details zu dem Skript:
--------------------------------
Das Skript verwendet viele Techniken die man sinnvoll bei der WEB-Programmierung einsetzt.

Es besteht aus 3 Skripten, einem
- Main-Skript (das auch kompiliert und gestartet wird)
- 2 Watcher Skripten (diese fungieren als Parallel-Robots für bestimmte zeitlich nicht zuordenbare Aufgaben)

Das Main-Skript steuert den ganzen Ablauf.
Die "Watcher-Skripte" bedienen WEB-ELemente die "mal kommen und mal nicht"
oder die "zeitlich nicht genau zugeordnet" werden können.

"Kommt das Fenster oder kommt es nicht"?
Der Vorteil von den Parallel-Robots ist, dass man lange Wartezeiten spart
Man wartet nicht ob das Fenster kommt sondern das Skript läuft einfach weiter.
Sollte das jeweilige Element erscheinen, kümmert sich der Parallel-Robot darum.
Das ist das Gleiche Prinzip wie bei den DBC\ oder WBC\ Befehlen - aber eben angewendet auf WEB-Programmierung.

Gestartet werden die Watcher-Skripte mit

Code: Select all

VAR\$$REM=?RemExe
EXX\$$REM|$ev4$\Watcher.rem
EXX\$$REM|$ev4$\Watcher2.rem
und laufen dann so lange bis entweder das FF-Fenster geschlossen wird ... dies wird durch den SID\-Befehl erreicht.
Dieser koppelt das Skript an das Hauptfenster. So erreichen wir, dass das Skript nie länger lebt als das Hauptskript.
Falls man das Skript als EXE-Datei kompilieren will, ist es wichtig die Dateien in die Exe manuell einzubinden.
Dies geschieht mit der #INC: Direktive.

Code: Select all

'#INC:?path\Watcher.rem
'#INC:?path\Watcher2.rem
Hier nun ein Auszug aus dem Watcher Skript.

Code: Select all

' Auszug aus dem Watcher.rem Skript
STW\mozillawindowclass\virustotal - mozilla firefox|w2268
HTV\$$MYW
SID\
am Ende des Watcher-Skriptes finden wir noch eine Zeile:

Code: Select all

:always
SBT\1|Watcher 1 ended.
@
diese bewirkt, dass die folgende Zeile auf jeden Fall aufgerufen wird wenn sich das Skript bendet.
Und wird hier nur kosmetisch verwendet um mit einer Meldun das Skriptende anzuzeigen.

Code: Select all

SBT\1|Watcher 1 ended.
Dazu wird ein Bubble-Text verwendet der gleichzeitig eine Sekunde Pause macht um dem Fenster Zeit zu geben, sich zu schliessen.

Das Skript ruft die "Reanalyze" Funktion von VIrustotal nicht automatisch auf, da dort dann ein "Ich bin kein Robot-Captcha" erscheint, das der Robot natürlich nicht bearbeiten kann, denn schliesslich sit er ja ein Robot .
Das Unterprogramm zum Aufruf der Funktion ist jedoch enthalten.


Die WEB-Programmierung
---------------------------------------

Die eigentliche WEB-Programmierung funktionier im Wesentlichen mit AFO\, AGR\ und ANT\ um Elemente zu lokalisieren,
und wir nehmen ARP\ um den Text an der Stelle zu lesen. In diesem Fall das Ergebnis der Virustotal Auswertung.

Code: Select all

:ReadResult
SCW\$$MYT
AGR\360|42\Score\\\:ero
AGR\360|42\&EXACT:Community\\\:ero
ANT\u|8|42
ARP\
VAR\$$TXA=$av01$
ANT\u|2|42
ARP\
VAR\$$TXB=$av01$
RET\

Im Folgenden nun der Code für den VIRUSTOTAL UPLOADER
getestet bei mir unter Windows 10.

Code: Select all

' +++ main_Virustotal_Filescan.rem +++
' Zweck: 
' erstellt am: 23.08.2007
' von: Theo Gottwald
'========================
'#SPI:AutoSettings
'#EXE:?path\
'#MAN:RA
'#INC:?path\Watcher.rem
'#INC:?path\Watcher2.rem


KRM\2
' PFAD der Gescannt werden soll hier eintragen
VAR\$$WRF=C:\Program Files (x86)\Matrix42\Package Robot

GSB\Initialisierung

FEF\$$WRF|*.exe|doit|$$FIL!
FEF\$$WRF|*.dll|doit|$$FIL!

MBX\Fertig
@
'-----------------------------------------------
:doit
NEF\$$FIL
   MBX\Die Datei: $crlf$$$FIL$crlf$existiert nicht.
EEF\

GSB\OpenLoc_Firefox
GSB\RunWatcher
CAS\1
GSB\AnswerDialog
' Deaktiviert wg. Captcha-Check auf Virustotal
' GSB\Reanalyze
GSB\ReadResult
GSB\WriteToDisk
@
'-----------------------------------------------
:Initialisierung
VAR\$$VTT=http://www.virustotal.com/de/
VAR\$$REM=?RemExe

VAR\$$OUF=$ev4$\Virus-Scan$datetime$.txt
VAR\$$OUT=VIRUS TOTAL Resultate ($datetime$) "$$WRF"$crlf$
CTF\$$OUF<$$OUT
RET\
'-----------------------------------------------
:Reanalyze
STW\mozillawindowclass\virustotal - mozilla firefox|w10416
AGR\42\engine&AND: this file\
ANT\r|40
MLI\
WII\5
CAS\1
RET\
'-----------------------------------------------
:WriteToDisk
ALB\$$FIL>$$FIN
GFI\$$FIL
VAR\$$ESD=Erstellt: $v5$$tab$
GFV\$$FIL
VAR\$$OUT=$$FIN$tab$$$ESD$v3$$tab$ ->  -- Result: ($$TXA/$$TXB)
ATF\$$OUF<$$OUT
RET\
'-----------------------------------------------
:ReadResult
SCW\$$MYT
AGR\360|42\Score\\\:ero
AGR\360|42\&EXACT:Community\\\:ero
ANT\u|8|42
ARP\
VAR\$$TXA=$av01$
ANT\u|2|42
ARP\
VAR\$$TXB=$av01$
RET\
'-----------------------------------------------
:AnswerDialog
' Dateiname eintragen
SCW\$$MYT
SFW\
SAW\
AGR\42!oom\&EXACT:Choose file

STW\#32770\datei hochladen|w492
HTV\$$DIA
WII\15
SWP\0,0
SFW\
GCW\1148\\edit\*|w33
HTV\$$DIC
WII\
MMV\
MLC\
CAS\1
MLC\
SDT\$$FIL
GSB\Closedia
RET\
'-----------------------------------------------
' Close Dialog Windows
:Closedia
STW\#32770\datei hochladen|w492
AFO\43\Öffnen&&\notext\notext\3\\\'88,26\0,0
ADA\
MTW\
RET\
'-----------------------------------------------
:OpenLoc_Firefox
CAW\mozillawindowclass\virustotal
EXR\firefox|$$VTT

STW\mozillawindowclass\virustotal - mozilla firefox|w2268
HTV\$$MYT
SWP\0,0|1163,1042
RET\
'-----------------------------------------------
:RunWatcher
EXX\$$REM|$ev4$\Watcher.rem
EXX\$$REM|$ev4$\Watcher2.rem
RET\

'-----------------------------------------------
:ero
MBX\Ergebnis konnte nicht ermittelt werden.
@

Teil-Skript 2

Code: Select all

' +++ Watcher.rem +++
' erstellt am: 02.03.2020
' von: Theo Gottwald
'========================
'
SBT\1+|Watcher 1 started
STW\mozillawindowclass\virustotal - mozilla firefox|w2268
HTV\$$MYW
SID\

:weiter
SCW\$$MYW
AGR\4|42!onm\&EXACT:Confirm Upload\\\:weiter
MLI\
@

:always
SBT\1|Watcher 1 ended.
@
Teil-Skript 3

Code: Select all

' +++ Watcher2.rem +++
' erstellt am: 02.03.2020
' von: Theo Gottwald
'========================
'
SBT\1+|Watcher 2 started
STW\mozillawindowclass\virustotal - mozilla firefox|w2268
HTV\$$MYW
SID\

IWF\60
   STW\mozilladialogclass\standardbrowser|w162
   AFO\43\Nicht jetzt&&\notext\notext\2\\'*3/3\'75,27\380,106
   MDC\
EWF\
@
:always
SBT\1|Watcher 2 ended.
@

Hier das Ergebnis dass das Skript liefert wenn man es auf das MPR -Verzeichnis anwendet.

Code: Select all


VIRUS TOTAL Resultate (200302_135643) $$WRF
accanalyzer.exe	Erstellt: 19.09.2019 13:28:16	1.0.0.78	 ->  -- Result: (70/0)
analyzer.exe	Erstellt: 19.09.2019 13:28:16	2.0.0.508	 ->  -- Result: (71/3)
chckhwnd.exe	Erstellt: 19.09.2019 13:28:16	1.1.0.41	 ->  -- Result: (70/0)
dwp.exe	Erstellt: 19.09.2019 13:28:16	1.0.0.131	 ->  -- Result: (72/0)
plugin01.exe	Erstellt: 19.09.2019 13:28:16	1.0.0.461	 ->  -- Result: (68/2)
process.exe	Erstellt: 19.09.2019 13:28:16	1.2.0.109	 ->  -- Result: (72/2)
rashelp.exe	Erstellt: 19.09.2019 13:28:16	noversion	 ->  -- Result: (71/2)
remedit.exe	Erstellt: 19.09.2019 13:28:16	4.3.0.3941	 ->  -- Result: (72/2)
remote.exe	Erstellt: 19.09.2019 13:28:16	8.0.0.3994	 ->  -- Result: (72/2)
TestApp.exe	Erstellt: 19.09.2019 13:28:16	noversion	 ->  -- Result: (69/2)
testform.exe	Erstellt: 19.09.2019 13:28:16	1.0.0.0	 ->  -- Result: (71/2)
unins000.exe	Erstellt: 19.09.2019 13:28:16	51.1052.0.0	 ->  -- Result: (70/0)
watch.exe	Erstellt: 19.09.2019 13:28:16	noversion	 ->  -- Result: (72/3)
watchdog.exe	Erstellt: 19.09.2019 13:28:16	1.1.0.23	 ->  -- Result: (70/2)
watchmsg.exe	Erstellt: 19.09.2019 13:28:16	1.1.0.151	 ->  -- Result: (70/2)
watchwnd.exe	Erstellt: 19.09.2019 13:28:16	1.0.0.41	 ->  -- Result: (68/3)
wr_dbg.exe	Erstellt: 19.09.2019 13:28:16	1.0.0.22	 ->  -- Result: (68/2)
wr_dst.exe	Erstellt: 19.09.2019 13:28:16	1.0.0.98	 ->  -- Result: (71/2)
X64cshk.exe	Erstellt: 19.09.2019 13:28:38	1.0.1.0	 ->  -- Result: (68/1)
X64dtop.exe	Erstellt: 19.09.2019 13:28:38	1.0.1.0	 ->  -- Result: (71/0)
X64Hlp_E.exe	Erstellt: 19.09.2019 13:28:38	1.0.1.0	 ->  -- Result: (64/0)
X64Hlp_R.exe	Erstellt: 19.09.2019 13:28:38	1.0.1.0	 ->  -- Result: (72/0)
X64HlpRG.exe	Erstellt: 19.09.2019 13:28:38	1.0.1.0	 ->  -- Result: (72/0)
X64hwnd.exe	Erstellt: 19.09.2019 13:28:38	1.0.1.0	 ->  -- Result: (72/1)
X64mnhk.exe	Erstellt: 19.09.2019 13:28:38	1.0.1.0	 ->  -- Result: (71/0)
X64move.exe	Erstellt: 19.09.2019 13:28:16	1.0.0.1	 ->  -- Result: (72/1)
callback.dll	Erstellt: 19.09.2019 13:28:16	1.0.0.5	 ->  -- Result: (70/0)
Catseye.dll	Erstellt: 16.10.2019 12:10:25	4.0.0.4	 ->  -- Result: (71/0)
cpuidsdk.dll	Erstellt: 05.09.2018 14:14:28	1.0.2.1	 ->  -- Result: (67/0)
deepscan.dll	Erstellt: 05.09.2018 14:14:32	3.3.0.1	 ->  -- Result: (70/0)
ds_play.dll	Erstellt: 19.09.2019 13:28:16	1.0.1.14	 ->  -- Result: (67/0)
dsbtnclr.dll	Erstellt: 19.09.2019 13:28:16	1.0.0.4	 ->  -- Result: (71/0)
dscctl64.dll	Erstellt: 19.09.2019 13:28:38	1.0.0.1	 ->  -- Result: (71/0)
dsclip64.dll	Erstellt: 19.09.2019 13:28:38	1.0.1.0	 ->  -- Result: (71/0)
dsclipbd.dll	Erstellt: 19.09.2019 13:28:16	1.0.1.0	 ->  -- Result: (69/0)
dscomctl.dll	Erstellt: 19.09.2019 13:28:16	noversion	 ->  -- Result: (71/0)
dsdrive.dll	Erstellt: 19.09.2019 13:28:16	1.0.0.1	 ->  -- Result: (71/0)
dsdsktop.dll	Erstellt: 19.09.2019 13:28:16	noversion	 ->  -- Result: (70/0)
dsdtpx64.dll	Erstellt: 19.09.2019 13:28:38	noversion	 ->  -- Result: (71/0)
dsevtmsg.dll	Erstellt: 19.09.2019 13:28:16	noversion	 ->  -- Result: (71/0)
dsfiles.dll	Erstellt: 19.09.2019 13:28:16	1.0.1.7	 ->  -- Result: (71/0)
dsfiles1.dll	Erstellt: 19.09.2019 13:28:16	1.0.1.7	 ->  -- Result: (71/0)
dshandle.dll	Erstellt: 19.09.2019 13:28:16	1.2.4.6	 ->  -- Result: (55/0)
dshandle_a.dll	Erstellt: 19.09.2019 13:28:16	1.2.4.6	 ->  -- Result: (69/0)
dshash.dll	Erstellt: 19.09.2019 13:28:16	noversion	 ->  -- Result: (70/0)
dshwnd64.dll	Erstellt: 19.09.2019 13:28:38	1.2.4.5	 ->  -- Result: (69/0)
dshwndex.dll	Erstellt: 19.09.2019 13:28:16	1.2.0.9	 ->  -- Result: (71/0)
dskbhook.dll	Erstellt: 19.09.2019 13:28:16	1.0.2.4	 ->  -- Result: (71/0)
dsmemwlk.dll	Erstellt: 19.09.2019 13:28:16	noversion	 ->  -- Result: (71/1)
dsminmax.dll	Erstellt: 19.09.2019 13:28:16	1.0.0.1	 ->  -- Result: (70/0)
dsmissng.dll	Erstellt: 19.09.2019 13:28:16	1.0.0.1	 ->  -- Result: (70/1)
dsmnhk64.dll	Erstellt: 19.09.2019 13:28:38	1.0.0.1	 ->  -- Result: (71/0)
dsmnhook.dll	Erstellt: 19.09.2019 13:28:16	1.0.0.1	 ->  -- Result: (71/0)
dsmodal.dll	Erstellt: 19.09.2019 13:28:16	1.1.0.4	 ->  -- Result: (69/0)
dsmouse.dll	Erstellt: 19.09.2019 13:28:16	1.2.0.3	 ->  -- Result: (70/0)
dsmousea.dll	Erstellt: 19.09.2019 13:28:16	1.2.0.4	 ->  -- Result: (71/0)
dsmouseb.dll	Erstellt: 19.09.2019 13:28:16	1.2.0.4	 ->  -- Result: (71/0)
dsmove.dll	Erstellt: 19.09.2019 13:28:16	noversion	 ->  -- Result: (67/0)
dsmovx64.dll	Erstellt: 19.09.2019 13:28:16	noversion	 ->  -- Result: (71/0)
dsnetwrk.dll	Erstellt: 19.09.2019 13:28:16	1.0.1.4	 ->  -- Result: (70/0)
dsrascon.dll	Erstellt: 19.09.2019 13:28:16	1.2.0.2	 ->  -- Result: (70/0)
dsremedi.dll	Erstellt: 19.09.2019 13:28:16	1.0.1.2	 ->  -- Result: (71/0)
dsremote.dll	Erstellt: 19.09.2019 13:28:16	noversion	 ->  -- Result: (69/0)
dsrgstry.dll	Erstellt: 19.09.2019 13:28:16	1.2.0.9	 ->  -- Result: (69/0)
dsrgx64.dll	Erstellt: 19.09.2019 13:28:38	1.2.0.8	 ->  -- Result: (71/0)
dsscrnsv.dll	Erstellt: 19.09.2019 13:28:16	1.0.0.2	 ->  -- Result: (71/0)
dssecure.dll	Erstellt: 19.09.2019 13:28:16	1.0.0.4	 ->  -- Result: (71/0)
dsshare.dll	Erstellt: 19.09.2019 13:28:16	noversion	 ->  -- Result: (71/1)
dsshare9.dll	Erstellt: 19.09.2019 13:28:16	noversion	 ->  -- Result: (69/0)
dswndtxt.dll	Erstellt: 19.09.2019 13:28:16	1.0.1.1	 ->  -- Result: (71/0)
freeimage.dll	Erstellt: 05.09.2018 14:14:25	3.8.0.0	 ->  -- Result: (69/0)
libcrypto-1_1.dll	Erstellt: 01.02.2019 10:40:25	1.1.1.1	 ->  -- Result: (69/0)
libcurl.dll	Erstellt: 01.02.2019 10:40:25	7.63.0.0	 ->  -- Result: (68/0)
libssl-1_1.dll	Erstellt: 01.02.2019 10:40:25	1.1.1.1	 ->  -- Result: (69/0)
msvbvm60.dll	Erstellt: 05.09.2018 14:14:31	6.0.98.2	 ->  -- Result: (69/0)
msvcm90.dll	Erstellt: 05.09.2018 14:14:31	9.0.21022.8	 ->  -- Result: (72/0)
msvcp90.dll	Erstellt: 05.09.2018 14:14:31	9.0.21022.8	 ->  -- Result: (71/0)
msvcr90.dll	Erstellt: 05.09.2018 14:14:31	9.0.21022.8	 ->  -- Result: (72/0)
setacl.dll	Erstellt: 19.09.2019 13:28:16	1.0.0.1	 ->  -- Result: (71/0)
tbtninfo.dll	Erstellt: 19.09.2019 13:28:16	noversion	 ->  -- Result: (69/0)
tkacchlp.dll	Erstellt: 05.09.2018 14:14:25	1.0.1.4	 ->  -- Result: (70/0)
vb6de.dll	Erstellt: 05.09.2018 14:14:31	6.0.89.88	 ->  -- Result: (72/1)
wrcbtshl.dll	Erstellt: 19.09.2019 13:28:16	1.4.0.0	 ->  -- Result: (71/1)
wrcctl64.dll	Erstellt: 19.09.2019 13:28:38	1.0.0.1	 ->  -- Result: (71/0)
wrcomctl.dll	Erstellt: 19.09.2019 13:28:16	noversion	 ->  -- Result: (71/0)
wrcshk64.dll	Erstellt: 19.09.2019 13:28:38	1.0.0.1	 ->  -- Result: (65/0)
wrkbhook.dll	Erstellt: 19.09.2019 13:28:16	1.0.2.7	 ->  -- Result: (66/0)
zlib32.dll	Erstellt: 05.09.2018 14:14:26	1.1.3.0	 ->  -- Result: (71/0)

Post Reply

Return to “Package Robot”

Who is online

Users browsing this forum: No registered users and 6 guests