Monday, February 19, 2018

install_lamp

install apache2


apt-get update

apt-get install -y apache2

open web brower: http://172.17.71.216

//if can't open this page, use `service apache2 restart` then retry

install php

  1. apt-get install -y php5 libapache2-mod-php5
  2. vim /var/www/html/test.php with
    
    <?php
    
    phpinfo();
    
    ?>
    
    
  3. test http://172.17.71.216/test.php

maintain apache

clear log


service apache2 stop

rm -rf /var/log/apache2/*

touch error.log && touch access.log && touch other_vhosts_access.log

chmod 777 error.log && chmod 777 access.log && chmod 777 other_vhosts_access.log

service apache2 start

install_or_upgrade_npm

cd /root/U64DengOnMyWorkVBox
ls -l | grep "^d*"| wc -l //count for folders

curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
apt-get install nodejs
//nodejs is the newest!

ls -l | grep "^d*"| wc -l //count for folders

npm -v
//5.6.0

/*
if npm is not the version you want, use
npm install npm@latest -g // npm install npm@ver -g
///updated to 5.6.0
*/


int your prj folder:
npm init
name:
 (default)
ver:use the smallest and let it update
 1.0.0
description:
 npm init javascript-obfuscator, zxxu
git repository:
 https://github.com/javascript-obfuscator/javascript-obfuscator

//If you want to depend on the package from your own module, using something like Node.js' require, then you want to install locally. This is npm install's default behavior.
//npm install --save-dev javascript-obfuscator
npm install javascript-obfuscator

FortigatePortForwarding


//refer http://cookbook.fortinet.com/using-virtual-ips-configure-port-forwarding-54/


Go to Policy & Objects > Virtual IPs > Create New > Virtual IP:

name = js_deobfu_statistics
External IP Address/Range = 172.17.71.216
Mapped IP Address/Range = 192.168.1.12
Enable Port Forwarding and add a VIP for TCP port 80



Adding VIPs to a VIP group//as we may add 21, 22 mappings
Go to Policy & Objects > Virtual IPs > Create New > Virtual IP Group.
in this example, webservers group. Under Members, include all VIPs(js_deobfu_statistics) previously created.






Go to Policy and Objects . IPv4 Policy and create a security policy allowing access to a server behind the firewall:
name = PortForwarding
Outgoing Interface = internal
Source = all
Destination Address = webservers
NAT = disabled // so that the server sees the original source addresses of the packets it receives.

Wednesday, February 7, 2018

replace all occurs of "PRJ_DIR" into "PRJ_PATH"


replace all occurs of "PRJ_DIR" into "PRJ_PATH"

grep
-r, --recursive           like --directories=recurse
-l, --files-with-matches  print only names of FILEs containing matches


grep -rl PRJ_DIR ./ | xargs sed -i 's/PRJ_DIR/PRJ_PATH/g'