there was an attempt to router2
This commit is contained in:
		
							
								
								
									
										37
									
								
								routerapi2.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										37
									
								
								routerapi2.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,37 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
source .env
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# vars used from .env
 | 
			
		||||
#ROUTER_USERNAME
 | 
			
		||||
#ROUTER_PASSWORD
 | 
			
		||||
#ROUTER_ADDRESS
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
SesTokInfo_req(){
 | 
			
		||||
req=$(curl -s $ROUTER_ADDRESS/api/webserver/SesTokInfo)
 | 
			
		||||
TokInfo=$(echo $req | xmlstarlet sel -t -v "/response/TokInfo")
 | 
			
		||||
SesInfo=$(echo $req | xmlstarlet sel -t -v "/response/SesInfo")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
gen_pass_hash(){
 | 
			
		||||
hash1=$(echo -n $ROUTER_PASSWORD| sha256sum | awk '{print $1}')
 | 
			
		||||
hash2=$(echo -n $ROUTER_USERNAME$hash1$TokInfo| sha256sum | awk '{print $1}')
 | 
			
		||||
passhash=$hash2
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
gen_login_body(){
 | 
			
		||||
body=$(echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?><request><username>$ROUTER_USERNAME</username><password_type>$password_type</password_type><password>$passhash")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# exec oder
 | 
			
		||||
SesTokInfo_req
 | 
			
		||||
gen_pass_hash
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# debug
 | 
			
		||||
echo $TokInfo
 | 
			
		||||
echo $SesInfo
 | 
			
		||||
echo $passhash
 | 
			
		||||
echo $body
 | 
			
		||||
		Reference in New Issue
	
	Block a user