Python automatically installs the Rising antivirus software
- 2020-04-02 09:21:52
- OfStack
It is convenient for us to reinstall the latest version when it cannot be used or when the system is reinstalled.
But each installation required clicking the Next button several times, along with the serial number,ID, and so on. I hated the repetitive work, so I simply wrote a small script and let it install automatically
I can take a few minutes off while I install
The script USES the Python2.3 + Com object, so your system must have Python2.3 or later installed
Mark Hammond's Win32all module must also be installed
(special thanks to Mark Hammond who developed the super module Win32all, and thanks to the talented Python team who created the amazing Python language)
The script is simple to use, with RisingInstall. Py -c RisingInstall. CFG at the command line on the first run
Create a configuration file in the same directory, open it to modify sn,id,path,execpath, and fill in the serial number,id number, and installation path, respectively.
And the directory where the installer is located and the name of the installer
Then run risinginstall.py directly
But each installation required clicking the Next button several times, along with the serial number,ID, and so on. I hated the repetitive work, so I simply wrote a small script and let it install automatically
I can take a few minutes off while I install
The script USES the Python2.3 + Com object, so your system must have Python2.3 or later installed
Mark Hammond's Win32all module must also be installed
(special thanks to Mark Hammond who developed the super module Win32all, and thanks to the talented Python team who created the amazing Python language)
The script is simple to use, with RisingInstall. Py -c RisingInstall. CFG at the command line on the first run
Create a configuration file in the same directory, open it to modify sn,id,path,execpath, and fill in the serial number,id number, and installation path, respectively.
And the directory where the installer is located and the name of the installer
Then run risinginstall.py directly
######################################################################
# Create By WormChocolate
# RisingInstall.py Version Beta 1
# 2005/02/22 19:17 PM
# Test Wscript.Shell Object's Install Rising-Setup in Python
######################################################################
import win32com.client,time,os,sys,ConfigParser
wsh = win32com.client.Dispatch("Wscript.Shell")
def InstallRising(ConfigFileName="RisingInstall.cfg"):
if os.path.exists(ConfigFileName):
cfg = ConfigParser.ConfigParser()
cfg.read(ConfigFileName)
try:
sn = cfg.get("Install","sn")
id = cfg.get("Install","id")
installpath = cfg.get("Install","path")
execpath = cfg.get("Install","execpath")
splashsec = int(cfg.get("Program","splashsec"))
languagesec = int(cfg.get("Program","languagesec"))
itemsec = int(cfg.get("Program","itemsec"))
wshe = wsh.Exec(execpath)
pid = wshe.ProcessID
except:
print "ConfigParser faile"
sys.exit(1)
if pid != "":
wsh.AppActivate(pid)
time.sleep(splashsec)
wsh.SendKeys("{ENTER}")
time.sleep(languagesec)
wsh.SendKeys("%n")
#time.sleep(itemsec)
wsh.SendKeys("%a")
#time.sleep(itemsec)
wsh.SendKeys("%n")
#time.sleep(itemsec)
wsh.SendKeys(sn)
#time.sleep(itemsec)
wsh.SendKeys(id)
wsh.SendKeys("%n")
time.sleep(itemsec)
wsh.SendKeys("%s")
time.sleep(itemsec)
wsh.SendKeys("%n")
time.sleep(itemsec)
wsh.SendKeys("%n")
time.sleep(itemsec)
wsh.SendKeys(installpath)
wsh.SendKeys("%n")
time.sleep(itemsec)
wsh.SendKeys("%n")
wsh.SendKeys("%n")
else:
print "Config File " + ConfigFileName +" Not Found"
print "Now Auto Create This Config File Dot't Worry"
CreateCfg(ConfigFileName)
InstallRising()
def CreateCfg(cfgname):
if cfgname != "":
print "Createing Config File : "+ cfgname + "..."
contents = ["[Install]n","sn=n","id=n","path=c:\\Program Files\\rising\\Ravn","execpath = c:\\Rising17.06.exen"
"n[Program]n","splashsec=20n","languagesec=2n","itemsec=1n"]
cfg = open(cfgname,"w+t",256)
cfg.writelines(contents)
cfg.close()
print cfgname + " Create Ok..."
#----- Main -------------
if len(sys.argv) == 1 :
InstallRising()
elif len(sys.argv) == 2:
InstallRising(sys.argv[1])
elif len(sys.argv) == 3:
if sys.argv[1]=="-c" and sys.argv[2] != "":
CreateCfg(sys.argv[2])
print "Config File: " + sys.argv[2] + " Created OK..."
else:
print "Parm Error : nExample : "+sys.argv[0]+" -c ConfigFileName.cfg"
else:
print "Script Error"