Fix encoding and permission issues
This commit is contained in:
parent
9534d9109b
commit
6e5465f933
|
@ -1 +0,0 @@
|
||||||
theme: jekyll-theme-slate
|
|
9
bash
9
bash
|
@ -1,9 +0,0 @@
|
||||||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
|
|
||||||
<html><head>
|
|
||||||
<title>404 Not Found</title>
|
|
||||||
</head><body>
|
|
||||||
<h1>Not Found</h1>
|
|
||||||
<p>The requested URL /fluxion was not found on this server.</p>
|
|
||||||
<p>Additionally, a 404 Not Found
|
|
||||||
error was encountered while trying to use an ErrorDocument to handle the request.</p>
|
|
||||||
</body></html>
|
|
20
changelog
20
changelog
|
@ -1,20 +0,0 @@
|
||||||
----------------------- General -----------------------
|
|
||||||
revision=1
|
|
||||||
|
|
||||||
|
|
||||||
---------------------- Changelog ----------------------
|
|
||||||
|
|
||||||
[Version: 2 , Revision 1]
|
|
||||||
|
|
||||||
- rewrite code
|
|
||||||
- move files
|
|
||||||
- exitmode to lib/
|
|
||||||
- source files to language
|
|
||||||
|
|
||||||
- improve handeling
|
|
||||||
- remove disclaimer
|
|
||||||
- remove git support
|
|
||||||
- add checkupdate function
|
|
||||||
- fix airmon file
|
|
||||||
|
|
||||||
---------------------- Changelog ----------------------
|
|
|
@ -36,7 +36,7 @@ HANDSHAKE_PATH="/root/handshakes"
|
||||||
PASSLOG_PATH="/root/pwlog"
|
PASSLOG_PATH="/root/pwlog"
|
||||||
WORK_DIR=`pwd`
|
WORK_DIR=`pwd`
|
||||||
DEAUTHTIME="9999999999999"
|
DEAUTHTIME="9999999999999"
|
||||||
revision=8
|
revision=9
|
||||||
version=2
|
version=2
|
||||||
IP=192.168.1.1
|
IP=192.168.1.1
|
||||||
RANG_IP=$(echo $IP | cut -d "." -f 1,2,3)
|
RANG_IP=$(echo $IP | cut -d "." -f 1,2,3)
|
||||||
|
@ -55,7 +55,6 @@ Fiuscha="\033[0;35m"
|
||||||
blue="\033[1;34m"
|
blue="\033[1;34m"
|
||||||
transparent="\e[0m"
|
transparent="\e[0m"
|
||||||
|
|
||||||
|
|
||||||
general_back="Back"
|
general_back="Back"
|
||||||
general_error_1="Not_Found"
|
general_error_1="Not_Found"
|
||||||
general_case_error="Unknown option. Choose again"
|
general_case_error="Unknown option. Choose again"
|
||||||
|
@ -88,7 +87,7 @@ function conditional_clear() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function airmon {
|
function airmon {
|
||||||
chmod +x lib/airmon/airmon
|
chmod +x lib/airmon/airmon.sh
|
||||||
}
|
}
|
||||||
airmon
|
airmon
|
||||||
|
|
||||||
|
@ -132,7 +131,7 @@ fi
|
||||||
#Function to executed in case of unexpected termination
|
#Function to executed in case of unexpected termination
|
||||||
trap exitmode SIGINT SIGHUP
|
trap exitmode SIGINT SIGHUP
|
||||||
|
|
||||||
source lib/exitmode
|
source lib/exitmode.sh
|
||||||
|
|
||||||
#Languages for the web interface
|
#Languages for the web interface
|
||||||
source language/source
|
source language/source
|
||||||
|
@ -151,13 +150,6 @@ function top(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
##################################### < END OF CONFIGURATION SECTION > #####################################
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
############################################## < START > ##############################################
|
############################################## < START > ##############################################
|
||||||
|
|
||||||
# Check requirements
|
# Check requirements
|
||||||
|
@ -424,20 +416,18 @@ if [ $FLUX_DEBUG != 1 ]; then
|
||||||
read -N1 doupdate
|
read -N1 doupdate
|
||||||
echo -ne "$transparent"
|
echo -ne "$transparent"
|
||||||
doupdate=${doupdate:-"Y"}
|
doupdate=${doupdate:-"Y"}
|
||||||
if [ "$doupdate" = "Y" ]; then
|
if [ "$doupdate" = "Y" ]; then
|
||||||
|
cp $0 $HOME/flux_rev-$revision.backup
|
||||||
cp $0 $HOME/flux_rev-$revision.backup
|
curl "https://raw.githubusercontent.com/FluxionNetwork/fluxion/master/fluxion" -s -o $0
|
||||||
curl "https://raw.githubusercontent.com/FluxionNetwork/fluxion/master/fluxion" -s -o $0
|
echo
|
||||||
|
echo
|
||||||
echo
|
echo -e ""$red"
|
||||||
echo
|
Updated successfully! Restarting the script to apply the changes ..."$transparent""
|
||||||
echo -e ""$red"
|
sleep 3
|
||||||
Updated successfully! Restarting the script to apply the changes ..."$transparent""
|
chmod +x $0
|
||||||
sleep 3
|
exec $0
|
||||||
chmod +x $0
|
exit
|
||||||
exec $0
|
fi
|
||||||
exit
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -459,14 +449,6 @@ function infoap {
|
||||||
echo -e " "$blue"BSSID"$transparent" = $mac (\e[1;33m$Host_MAC_MODEL $transparent)"
|
echo -e " "$blue"BSSID"$transparent" = $mac (\e[1;33m$Host_MAC_MODEL $transparent)"
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
############################################## < START > ##############################################
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
############################################### < MENU > ###############################################
|
############################################### < MENU > ###############################################
|
||||||
|
|
||||||
# Windows + Resolution
|
# Windows + Resolution
|
||||||
|
@ -548,7 +530,7 @@ language; setinterface
|
||||||
function language {
|
function language {
|
||||||
|
|
||||||
iptables-save > $DUMP_PATH/iptables-rules
|
iptables-save > $DUMP_PATH/iptables-rules
|
||||||
conditional_clear
|
conditional_clear
|
||||||
|
|
||||||
if [ "$FLUX_AUTO" = "1" ];then
|
if [ "$FLUX_AUTO" = "1" ];then
|
||||||
source $WORK_DIR/language/en; setinterface
|
source $WORK_DIR/language/en; setinterface
|
||||||
|
@ -570,25 +552,25 @@ else
|
||||||
echo -e " "$red"["$yellow"7"$red"]"$transparent" Italian "
|
echo -e " "$red"["$yellow"7"$red"]"$transparent" Italian "
|
||||||
echo -e " "$red"["$yellow"8"$red"]"$transparent" Czech "
|
echo -e " "$red"["$yellow"8"$red"]"$transparent" Czech "
|
||||||
echo -e " "$red"["$yellow"9"$red"]"$transparent" Greek "
|
echo -e " "$red"["$yellow"9"$red"]"$transparent" Greek "
|
||||||
echo -e " "$red"["$yellow"10"$red"]"$transparent" French "
|
echo -e " "$red"["$yellow"10"$red"]"$transparent" French "
|
||||||
echo -e " "$red"["$yellow"11"$red"]"$transparent" Slovenian "
|
echo -e " "$red"["$yellow"11"$red"]"$transparent" Slovenian "
|
||||||
echo " "
|
echo " "
|
||||||
echo -n -e ""$red"["$blue"deltaxflux"$yellow"@"$white"fluxion"$red"]-["$yellow"~"$red"]"$transparent""
|
echo -n -e ""$red"["$blue"deltaxflux"$yellow"@"$white"fluxion"$red"]-["$yellow"~"$red"]"$transparent""
|
||||||
read yn
|
read yn
|
||||||
echo ""
|
echo ""
|
||||||
case $yn in
|
case $yn in
|
||||||
1 ) source $WORK_DIR/language/en; break;;
|
1 ) source $WORK_DIR/language/en; break;;
|
||||||
2 ) source $WORK_DIR/language/ger; break;;
|
2 ) source $WORK_DIR/language/ger; break;;
|
||||||
3 ) source $WORK_DIR/language/ro; break;;
|
3 ) source $WORK_DIR/language/ro; break;;
|
||||||
4 ) source $WORK_DIR/language/tu; break;;
|
4 ) source $WORK_DIR/language/tu; break;;
|
||||||
5 ) source $WORK_DIR/language/esp; break;;
|
5 ) source $WORK_DIR/language/esp; break;;
|
||||||
6 ) source $WORK_DIR/language/ch; break;;
|
6 ) source $WORK_DIR/language/ch; break;;
|
||||||
7 ) source $WORK_DIR/language/it; break;;
|
7 ) source $WORK_DIR/language/it; break;;
|
||||||
8 ) source $WORK_DIR/language/cz break;;
|
8 ) source $WORK_DIR/language/cz break;;
|
||||||
9 ) source $WORK_DIR/language/gr; break;;
|
9 ) source $WORK_DIR/language/gr; break;;
|
||||||
10 ) source $WORK_DIR/language/fr; break;;
|
10 ) source $WORK_DIR/language/fr; break;;
|
||||||
11 ) source $WORK_DIR/language/svn; break;;
|
11 ) source $WORK_DIR/language/svn; break;;
|
||||||
* ) echo "Unknown option. Please choose again"; conditional_clear ;;
|
* ) echo "Unknown option. Please choose again"; conditional_clear ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
@ -612,8 +594,8 @@ function setinterface {
|
||||||
done
|
done
|
||||||
|
|
||||||
# Create a variable with the list of physical network interfaces
|
# Create a variable with the list of physical network interfaces
|
||||||
readarray -t wirelessifaces < <(./lib/airmon/airmon |grep "-" | cut -d- -f1)
|
readarray -t wirelessifaces < <(./lib/airmon/airmon.sh |grep "-" | cut -d- -f1)
|
||||||
INTERFACESNUMBER=`./lib/airmon/airmon | grep -c "-"`
|
INTERFACESNUMBER=`./lib/airmon/airmon.sh | grep -c "-"`
|
||||||
|
|
||||||
|
|
||||||
if [ "$INTERFACESNUMBER" -gt "0" ]; then
|
if [ "$INTERFACESNUMBER" -gt "0" ]; then
|
||||||
|
@ -649,8 +631,8 @@ function setinterface {
|
||||||
setinterface
|
setinterface
|
||||||
fi
|
fi
|
||||||
|
|
||||||
readarray -t naggysoftware < <(./lib/airmon/airmon check $PREWIFI | tail -n +8 | grep -v "on interface" | awk '{ print $2 }')
|
readarray -t naggysoftware < <(./lib/airmon/airmon.sh check $PREWIFI | tail -n +8 | grep -v "on interface" | awk '{ print $2 }')
|
||||||
WIFIDRIVER=$(./lib/airmon/airmon | grep "$PREWIFI" | awk '{print($(NF-2))}')
|
WIFIDRIVER=$(./lib/airmon/airmon.sh | grep "$PREWIFI" | awk '{print($(NF-2))}')
|
||||||
|
|
||||||
if [ ! "$(echo $WIFIDRIVER | egrep 'rt2800|rt73')" ]; then
|
if [ ! "$(echo $WIFIDRIVER | egrep 'rt2800|rt73')" ]; then
|
||||||
rmmod -f "$WIFIDRIVER" &>$flux_output_device 2>&1
|
rmmod -f "$WIFIDRIVER" &>$flux_output_device 2>&1
|
||||||
|
@ -675,7 +657,7 @@ function setinterface {
|
||||||
break;
|
break;
|
||||||
done
|
done
|
||||||
|
|
||||||
WIFIMONITOR=$(./lib/airmon/airmon start $PREWIFI | grep "enabled on" | cut -d " " -f 5 | cut -d ")" -f 1)
|
WIFIMONITOR=$(./lib/airmon/airmon.sh start $PREWIFI | grep "enabled on" | cut -d " " -f 5 | cut -d ")" -f 1)
|
||||||
WIFI_MONITOR=$WIFIMONITOR
|
WIFI_MONITOR=$WIFIMONITOR
|
||||||
WIFI=$PREWIFI
|
WIFI=$PREWIFI
|
||||||
|
|
||||||
|
@ -1328,7 +1310,7 @@ function creassl {
|
||||||
function webinterface {
|
function webinterface {
|
||||||
|
|
||||||
|
|
||||||
chmod 400 /root/server.pem
|
chmod 400 $DUMP_PATH/server.pem
|
||||||
|
|
||||||
if [ "$FLUX_AUTO" = "1" ];then
|
if [ "$FLUX_AUTO" = "1" ];then
|
||||||
matartodo; ConnectionRESET; selection
|
matartodo; ConnectionRESET; selection
|
BIN
logos/logo1.jpg
BIN
logos/logo1.jpg
Binary file not shown.
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 1.0 MiB |
BIN
logos/logo2.jpg
BIN
logos/logo2.jpg
Binary file not shown.
Before Width: | Height: | Size: 1.0 MiB |
|
@ -1,307 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: cp852 -*-
|
|
||||||
|
|
||||||
import sys
|
|
||||||
import getopt
|
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
sys.path.insert(0, './locale')
|
|
||||||
|
|
||||||
# ###################
|
|
||||||
# ## OPTIONS ########
|
|
||||||
# ###################
|
|
||||||
site_name = ''
|
|
||||||
site_language = ''
|
|
||||||
installed_sites = 0
|
|
||||||
flux_cont = ''
|
|
||||||
#flux_comp_versions = ['0.24']
|
|
||||||
flinstall_version = '0.11'
|
|
||||||
# ###################
|
|
||||||
class color:
|
|
||||||
PURPLE = '\033[95m'
|
|
||||||
CYAN = '\033[96m'
|
|
||||||
DARKCYAN = '\033[36m'
|
|
||||||
BLUE = '\033[94m'
|
|
||||||
GREEN = '\033[92m'
|
|
||||||
YELLOW = '\033[93m'
|
|
||||||
RED = '\033[91m'
|
|
||||||
BOLD = '\033[1m'
|
|
||||||
UNDERLINE = '\033[4m'
|
|
||||||
END = '\033[0m'
|
|
||||||
|
|
||||||
def main(argv):
|
|
||||||
global site_name, site_language
|
|
||||||
if os.geteuid() != 0:
|
|
||||||
exit('You need to have root privileges to run this script.\nPlease try again, this time using \'sudo\'. Exiting....')
|
|
||||||
sys.exit()
|
|
||||||
usage = '>>>\tUsage:\n' +'\t\tsiteinstaller.py -f <filename>' +'\n\t\tsiteinstaller.py --file <file>\n\n>>>\tOnly *.tar.gz compressed files!'
|
|
||||||
try:
|
|
||||||
opts, args = getopt.getopt(sys.argv[1:], 'f:h', ['file=', 'help'])
|
|
||||||
if(len(opts) <= 0):
|
|
||||||
print(usage)
|
|
||||||
sys.exit()
|
|
||||||
except getopt.GetoptError:
|
|
||||||
print(usage)
|
|
||||||
sys.exit(2)
|
|
||||||
|
|
||||||
for opt, arg in opts:
|
|
||||||
if opt in ('-h', '--help'):
|
|
||||||
print(usage)
|
|
||||||
sys.exit(2)
|
|
||||||
elif opt in ('-f', '--file'):
|
|
||||||
if not('.tar.gz' in arg):
|
|
||||||
print('ONLY *.tar.gz files supported.')
|
|
||||||
sys.exit()
|
|
||||||
if(os.path.isfile(arg) == False):
|
|
||||||
print('Your file does not exist, maybe a typo?')
|
|
||||||
sys.exit()
|
|
||||||
site_name = arg[:arg.rfind('.tar.gz')]
|
|
||||||
site_language = site_name[site_name.rfind('_')+1:]
|
|
||||||
else:
|
|
||||||
print(usage)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main(sys.argv[1:])
|
|
||||||
|
|
||||||
# Language Selector
|
|
||||||
print('\033[1;91m [~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]')
|
|
||||||
print(' [ ]')
|
|
||||||
print(' [ FluxIon - Site Installer v' + flinstall_version + ' ]')
|
|
||||||
print('\033[94m [ ]')
|
|
||||||
print(' [~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]')
|
|
||||||
print('\033[39m')
|
|
||||||
print(' # Select your language:')
|
|
||||||
print('')
|
|
||||||
print('[1] English')
|
|
||||||
print('[2] German')
|
|
||||||
print('')
|
|
||||||
lang = raw_input(' [#]:')
|
|
||||||
if(lang == '1'):
|
|
||||||
from en_EN import language
|
|
||||||
elif(lang == '2'):
|
|
||||||
from de_DE import language
|
|
||||||
else:
|
|
||||||
from en_EN import language
|
|
||||||
|
|
||||||
# ###############
|
|
||||||
|
|
||||||
def check_fluxion():
|
|
||||||
global installed_sites, flux_cont
|
|
||||||
try:
|
|
||||||
fl = open('fluxion','rw')
|
|
||||||
flux_cont = fl.read()
|
|
||||||
fl.close()
|
|
||||||
except:
|
|
||||||
print(language.COULD_NOT_OPEN_FLUX)
|
|
||||||
sys.exit()
|
|
||||||
if(flux_cont <= 100):
|
|
||||||
print(language.NO_FLUXION_FOUND)
|
|
||||||
sys.exit()
|
|
||||||
flv = ''
|
|
||||||
flr = ''
|
|
||||||
fld = ''
|
|
||||||
if('version=' in flux_cont) and ('revision=' in flux_cont):
|
|
||||||
flv = flux_cont[flux_cont.find('version=')+8:]
|
|
||||||
flv = flv[:flv.find('\n')]
|
|
||||||
flr = flux_cont[flux_cont.find('revision=')+9:]
|
|
||||||
flr = flr[:flr.find('\n')]
|
|
||||||
else:
|
|
||||||
print(language.CORRUPTED_FLUX)
|
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
# Version check
|
|
||||||
#vchk = False
|
|
||||||
#for version in flux_comp_versions:
|
|
||||||
# if(version == flv):
|
|
||||||
# vchk = True
|
|
||||||
#if(vchk == False):
|
|
||||||
# print('Your fluxion version '+color.BOLD + flv + color.END + '. \nSupported versions are - ' + ' - '.join(reversed(flux_comp_versions)))
|
|
||||||
# sys.exit()
|
|
||||||
# ###############
|
|
||||||
|
|
||||||
installed_sites = int(flux_cont.count('elif [ "$webconf" ='))
|
|
||||||
fls = str(installed_sites + 1)
|
|
||||||
|
|
||||||
# Check on double installation!
|
|
||||||
fld = flux_cont[flux_cont.find('$DUMP_PATH/data/index.htm'):]
|
|
||||||
if(site_name in fld):
|
|
||||||
usdc = raw_input(language.DOUBLE_INSTALL + ' "' + site_name + '" ' + language.CONTINUE_ANYWAY + ' [Y\\n]')
|
|
||||||
if(len(usdc) <= 0) or (usdc == 'y') or (usdc == 'yes'):
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
sys.exit()
|
|
||||||
# ###############
|
|
||||||
|
|
||||||
return flv + '#' + flr + '#' + fls
|
|
||||||
|
|
||||||
def welcome():
|
|
||||||
flc = check_fluxion().split('#')
|
|
||||||
wsn = int(22 - len(site_name))
|
|
||||||
whitespacen = ''
|
|
||||||
wsl = int((22+6) - len(site_language))
|
|
||||||
whitespacel = ''
|
|
||||||
for i in xrange(wsn):
|
|
||||||
whitespacen += ' '
|
|
||||||
if(i+1 == wsn) and (i+1 <= wsn):
|
|
||||||
whitespacen += '#'
|
|
||||||
for i in xrange(wsl):
|
|
||||||
whitespacel += ' '
|
|
||||||
if(i+1 == wsl) and (i+1 <= wsl):
|
|
||||||
whitespacel += '#'
|
|
||||||
|
|
||||||
print('\033[1;91m [~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]')
|
|
||||||
print(' [ ]')
|
|
||||||
print(' [ FluxIon - Site Installer v'+ flinstall_version + ' ]')
|
|
||||||
print('\033[94m [ ]')
|
|
||||||
print(' [~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]')
|
|
||||||
print('\033[39m')
|
|
||||||
print(' # ############## FluxIon found! ##############')
|
|
||||||
print(' # \033[39mVersion: '+ flc[0] +' #')
|
|
||||||
print(' # \033[39mRevision: '+ flc[1] +' #')
|
|
||||||
print(' # \033[39mInstalled Sites: '+ flc[2] +' #')
|
|
||||||
print(' # ############################################')
|
|
||||||
print('')
|
|
||||||
print(' # ############################################')
|
|
||||||
print(' # \033[39mSiteName to install: ' + site_name + whitespacen)
|
|
||||||
print(' # \033[39mLanguage flag: ' + site_language + whitespacel)
|
|
||||||
print(' # ############################################')
|
|
||||||
print('')
|
|
||||||
print(' # ########### Everything correct? ############')
|
|
||||||
print('')
|
|
||||||
usc = raw_input(' # ' + language.BEGIN_INSTALL + '? [Y\\n]').lower()
|
|
||||||
if(len(usc) <= 0) or (usc == 'y') or (usc == 'yes'):
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
print('\n\t # ' + language.NOTHING_CHANGED)
|
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
# ########################################################################################
|
|
||||||
# ########################################################################################
|
|
||||||
# ########################################################################################
|
|
||||||
# ########################################################################################
|
|
||||||
# ########################################################################################
|
|
||||||
# ########################################################################################
|
|
||||||
# ########################################################################################
|
|
||||||
welcome()
|
|
||||||
|
|
||||||
# ###### First INSERT
|
|
||||||
def insert_at_secondlast_pos1():
|
|
||||||
global flux_cont, site_name, site_language
|
|
||||||
whitespaces = ''
|
|
||||||
search_string = 'echo -e " "$red"["$yellow"$n"$red"]"$transparent"\e'
|
|
||||||
ws = int(12 - len(site_name))
|
|
||||||
for i in xrange(ws):
|
|
||||||
whitespaces+=' '
|
|
||||||
insert_site = 'echo -e " "$red"["$yellow"$n"$red"]"$transparent" ' + site_name + whitespaces + '[' + site_language + '] ";n=` expr $n + 1`\n'
|
|
||||||
before = flux_cont[:int(flux_cont.rfind(search_string))]
|
|
||||||
after = '\t\t\t' + flux_cont[int(flux_cont.rfind(search_string)):]
|
|
||||||
flux_cont = before + insert_site + after
|
|
||||||
# ##########################################
|
|
||||||
|
|
||||||
# ###### Second INSERT
|
|
||||||
def insert_at_secondlast_pos2():
|
|
||||||
global installed_sites, flux_cont, site_name
|
|
||||||
site_number = str(installed_sites +1)
|
|
||||||
insert_site = 'elif [ "$webconf" = "'+ site_number +'" ]; then\n\t\t\t\t' + site_name + '\n\t\t\t\tbreak\n\n\t\t\t'
|
|
||||||
flux_cont = flux_cont[:int(flux_cont.rfind('elif [ "$webconf" ='))] + insert_site + flux_cont[int(flux_cont.rfind('elif [ "$webconf" =')):]
|
|
||||||
|
|
||||||
def last_option_correct_number2():
|
|
||||||
global installed_sites, flux_cont
|
|
||||||
acc = int(flux_cont.rfind('elif [ "$webconf" ='))
|
|
||||||
acc0 = int(flux_cont[acc:].find('" = "')+5)
|
|
||||||
before = flux_cont[:acc+acc0]
|
|
||||||
after = flux_cont[acc+acc0+2:]
|
|
||||||
flux_cont = before + str(installed_sites+2) + after
|
|
||||||
# ##########################################
|
|
||||||
|
|
||||||
# ###### Third INSERT
|
|
||||||
def insert_at_last_pos3():
|
|
||||||
global flux_cont, site_name
|
|
||||||
insert_site = '\n\nfunction ' + site_name + ' {\n\tmkdir $DUMP_PATH/data &>$flux_output_device\n\tcp $WORK_DIR/Sites/' + site_name + '/* $DUMP_PATH/data\n\t}'
|
|
||||||
before = flux_cont[:int(flux_cont.rfind('}'))+1]
|
|
||||||
after = flux_cont[int(flux_cont.rfind('}'))+1:]
|
|
||||||
flux_cont = before + insert_site + after
|
|
||||||
# ##########################################
|
|
||||||
|
|
||||||
print('')
|
|
||||||
print(' # '+ language.CREATING_BACKUP +'...')
|
|
||||||
try:
|
|
||||||
subprocess.Popen(['cp','fluxion', 'bckp_fluxion'])
|
|
||||||
except:
|
|
||||||
print(language.NO_PERM)
|
|
||||||
sys.exit()
|
|
||||||
print(' # ' + language.DONE + '!')
|
|
||||||
|
|
||||||
print('')
|
|
||||||
print(' # ' + language.COPYING_FILES + '...')
|
|
||||||
try:
|
|
||||||
subprocess.Popen(['tar','xfz', site_name + '.tar.gz', '-C', 'Sites/'])
|
|
||||||
except:
|
|
||||||
print(language.COULD_NOT_COPY + '...')
|
|
||||||
sys.exit()
|
|
||||||
print(' # ' + language.DONE + '!')
|
|
||||||
|
|
||||||
print('')
|
|
||||||
print(' # ' + language.RECONFIGURE_FLUXION_BASH + '...')
|
|
||||||
try:
|
|
||||||
insert_at_secondlast_pos1()
|
|
||||||
insert_at_secondlast_pos2()
|
|
||||||
last_option_correct_number2()
|
|
||||||
insert_at_last_pos3()
|
|
||||||
except:
|
|
||||||
print(language.INTERNAL_FAILURE + '...')
|
|
||||||
e = sys.exc_info()[0]
|
|
||||||
print(language.ERROR + ": %s" % e )
|
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
print(' # ' + language.DONE + '!')
|
|
||||||
|
|
||||||
print('')
|
|
||||||
print(' # '+ language.REWRITING_FLUXION_BASH + '...')
|
|
||||||
try:
|
|
||||||
wflux = open('fluxion','w')
|
|
||||||
wflux.write(flux_cont)
|
|
||||||
wflux.close()
|
|
||||||
except:
|
|
||||||
print(language.FATAL_ERROR + '[501]...')
|
|
||||||
print(language.TRYING_TO_RESTORE_BACKUP)
|
|
||||||
try:
|
|
||||||
subprocess.Popen(['mv','bckp_fluxion', 'fluxion'])
|
|
||||||
print('FluxIon ' + language.BACKUP_RESTORED + '...')
|
|
||||||
except:
|
|
||||||
print(language.FATAL_ERROR + '[502]...')
|
|
||||||
sys.exit()
|
|
||||||
print(' # ' + language.DONE + '!')
|
|
||||||
|
|
||||||
print('')
|
|
||||||
print(' # ' + language.SETTING_MODES + '...')
|
|
||||||
try:
|
|
||||||
subprocess.Popen(['chmod','755', 'Sites/' + site_name +'/'])
|
|
||||||
subprocess.Popen(['chmod','644', '-R', 'Sites/' + site_name +'/'])
|
|
||||||
print(' # ' + DONE + '!')
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
#print('ERROR[506]... ' + language.CONTINUE + '...')
|
|
||||||
#print("Unexpected error:", sys.exc_info()[0])
|
|
||||||
|
|
||||||
print('')
|
|
||||||
print(' # ' + language.VERIFYING_INTEG + '...')
|
|
||||||
try:
|
|
||||||
fluxit = open('fluxion','r')
|
|
||||||
integ_fluxion = fluxit.read()
|
|
||||||
fluxit.close()
|
|
||||||
if(len(integ_fluxion) == len(flux_cont)):
|
|
||||||
print(' # ' + language.DONE + '!')
|
|
||||||
print(' # ' + language.DELETING_BACKUP + '...')
|
|
||||||
subprocess.Popen(['rm','bckp_fluxion'])
|
|
||||||
else:
|
|
||||||
print(language.FATAL_ERROR + '[509]...')
|
|
||||||
sys.exit()
|
|
||||||
except:
|
|
||||||
print(language.FATAL_ERROR + '[503]...')
|
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
print('\n # ' + site_name + '" ' + language.SUCCESS + '!')
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue