forked from PowerScript/KatanaFramework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
97 lines (87 loc) · 7.48 KB
/
install
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/env python
#HEAD#########################################################
#
# Katana Framework | install
# Last Modified: 23/12/2016
#
#########################################################HEAD#
from core import Information, colors, Update
import os, time, subprocess
from sys import stdout
def Command_exe(msg,cmd,std):
i = "\033[1mSTATUS"+colors.W+":[Processing]"
stdout.write(" " + information + " " + msg + " %s" % i)
stdout.flush()
status_1=subprocess.call(cmd+' >/dev/null 2>&1', shell=True)
if status_1==0:
i = "[\033[1m"+colors.G+"OK"+colors.W+"]"
else:
i = "["+colors.R+"\033[1mERROR"+colors.W+"]["+colors.O+"\033[1mWARNING"+colors.W+"]"
stdout.write("\r" + " " + information + " " + msg +" STATUS:%s \r" % i)
print ""
print " "+colors.B+",:"+colors.W+" "+colors.B+":,"+colors.W+" "# ,: :,
print " "+colors.B+",/./"+colors.W+" _8_ "+colors.B+"\.\ "# /./ _8_ \.\
print " "+colors.B+",\ \\"+colors.W+"/"+colors.P+"("+colors.R+"O"+colors.P+")"+colors.W+"\\"+colors.B+"/ / "# \ \/( O )\/ /
print " "+colors.B+",\ \:::/ / "# \ \:::::/ /
print " /"+colors.O+"__"+colors.G+"---"+colors.O+"__"+colors.B+"\ "# /__---__\
print " ("+colors.O+"/__\ /__\\"+colors.B+")"+colors.W+" "# (/__\ /__\)
print " "+colors.B+"/"+colors.W+"\ .V. /"+colors.B+"\\"+colors.W+" "# /\ .V. /\
print " "+colors.B+"/"+colors.W+" \,---,/ "+colors.B+"\\"+colors.W+" "# / \,---,/ \
print " "+colors.B+"\\"+colors.W+"___TTTTT___"+colors.B+"/"+colors.W+" CODE: KATANA "# \___TTTTT___/
print " ::::\ "+colors.R+"|"+colors.W+"_____"+colors.R+"|"+colors.W+" /:::: DATE: "+Information.date+""# ::::\ "+colors.R+"|"+colors.W+"_____"+colors.R+"|"+colors.W+" /::::
print " (+ _"+colors.R+"|"+colors.W+" __"+colors.R+"|"+colors.W+"__ "+colors.R+"|"+colors.W+"_ +) CORE: "+Information.version+", BUILD: "+Information.build # (+ _"+colors.R+"|"+colors.W+" __"+colors.R+"|"+colors.W+"__ "+colors.R+"|"+colors.W+"_ +)
print " "+Information.Type+" "+colors.R+"|"+colors.W+" I_"+colors.R+"|"+colors.W+"KATANA."+colors.R+"|"+colors.W+"_I "+colors.R+"|"+colors.W+" "# "+colors.R+"|"+colors.W+" I_"+colors.R+"|"+colors.W+".ANATAK"+colors.R+"|"+colors.W+"_I "+colors.R+"|"+colors.W+"
print " "+colors.R+"|"+colors.W+" I_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+" "+colors.R+"|"+colors.W+" "# "+colors.R+"|"+colors.W+" I_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+" "+colors.R+"|"+colors.W+"
print " __________?_____________________________________ "# __________?_________________________________
print " {_"+colors.C+"B|"+colors.W+" "+colors.C+"Y|"+colors.W+" "+colors.R+"R|"+colors.W+" "+colors.W+"T|"+colors.W+" |"+colors.GR+"#################################"+colors.W+"/ "# {_"+colors.R+"|"+colors.W+" "+colors.R+"|"+colors.W+" "+colors.R+"|"+colors.W+" "+colors.R+"|"+colors.W+" I#################################/
print " ^ ^ ^ ^ ,ww "+colors.O+"FRAMEWORK"+colors.W+" ww, "# ^ ^ ^ ^ EHT KROWEMARF, dliuB
print " I_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+"_I "# I_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+"_I
print " \_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+"_/ "# \_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+"_"+colors.R+"|"+colors.W+"_/
print ""
print ""
if os.getuid() != 0:
print " ["+colors.R+"-"+colors.W+"] ERROR:"+colors.B+" Katana Install"+colors.B+" must be run as "+colors.R+"root"+colors.W+"."
print " ["+colors.R+"-"+colors.W+"] login as root ("+colors.R+"sudo"+colors.W+") or try "+colors.W+"sudo python install"+colors.W+"\n"
exit(1)
time.sleep(1)
Shortcuts="""
ln -f -r -s /usr/share/KatanaFramework/core/shorts/ktf.console /usr/bin/ktf.console ;
ln -f -r -s /usr/share/KatanaFramework/core/shorts/ktf.linker /usr/bin/ktf.linker ;
ln -f -r -s /usr/share/KatanaFramework/core/shorts/ktf.update /usr/bin/ktf.update ;
ln -f -r -s /usr/share/KatanaFramework/core/shorts/ktf.ktf /usr/bin/ktf.ktf ;
ln -f -r -s /usr/share/KatanaFramework/core/shorts/ktf.tool /usr/bin/ktf.tool ;
ln -f -r -s /usr/share/KatanaFramework/core/shorts/ktf.gui /usr/bin/ktf.gui ;
ln -f -r -s /usr/share/KatanaFramework/core/shorts/ktf.run /usr/bin/ktf.run
"""
Files="""
cp -r * /usr/share/KatanaFramework/doc/man/ /usr/local/share/man/man1/ ;
cd /usr/share/KatanaFramework/files/ ;
tar xvf /usr/share/KatanaFramework/files/exiftool.tar >/dev/null 2>&1;
tar xvf /usr/share/KatanaFramework/files/getdatareport.tar>/dev/null 2>&1;
rm -R /usr/share/KatanaFramework/files/*.tar >/dev/null 2>&1;
rm /usr/share/KatanaFramework/install >/dev/null 2>&1;
rm /usr/share/KatanaFramework/dependencies >/dev/null 2>&1;
rm /usr/share/KatanaFramework/README.md >/dev/null 2>&1
"""
Preinstall="""
rm -f /usr/bin/ktf.console;
rm -f /usr/bin/ktf.linker;
rm -f /usr/bin/ktf.update;
rm -f /usr/bin/ktf.ktf;
rm -f /usr/bin/ktf.tool;
rm -f /usr/bin/ktf.run;
rm -f /usr/bin/ktf.gui;
"""
print " INSTALLING"
print Command_exe("["+time.strftime('%H:%M:%S')+"] Pre-installing. ",Preinstall)
print Command_exe("["+time.strftime('%H:%M:%S')+"] Checking dependencies. ",'sudo bash dependencies')
print " ["+time.strftime('%H:%M:%S')+"] Checking Updates."
print " |"
Update.update("installer",False)
print " |"
print Command_exe("["+time.strftime('%H:%M:%S')+"] Creating Folder. ",'mkdir -p /usr/share/KatanaFramework')
print Command_exe("["+time.strftime('%H:%M:%S')+"] Copying files. ",'cp -r * /usr/share/KatanaFramework')
print Command_exe("["+time.strftime('%H:%M:%S')+"] Creating Shortcuts. ",Shortcuts)
print Command_exe("["+time.strftime('%H:%M:%S')+"] Extracting Files. ",Files)
print Command_exe("["+time.strftime('%H:%M:%S')+"] Giving privileges. ",'chmod -R -c 777 /usr/share/KatanaFramework/')
print "\n if all is [OK] Katana was installed, use ktf.console\n"