Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.82 KB | None | 0 0
  1. #!/bin/bash
  2. lofplay=52.0.0.0
  3.  
  4. fonction appconect
  5. {
  6. [[ $(which cedora) ]] && app=cedora
  7. [[ $(which crossover) ]] && app=crossover
  8. [[ $(which wine) ]] && app=wine
  9. [[ -z $app ]] && echo "no interpretator was found, you can try apt-get install wine to get on"
  10. #$app ./lof_play.exe
  11. echo "$app"
  12. }
  13.  
  14. cd $(dirname "${0}")
  15. ipserv=$(egrep -o "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" ./data/clientinfo.xml | sed -n '1p' )
  16. port=$(egrep -o "[0-9]{4,5}" ./data/clientinfo.xml | sed -n '1p' )
  17. echo "$ipserv and $port"
  18.  
  19. appconect()
  20.  
  21. iptry=$(netstat -nta |  awk '{print $5}' | grep -o $port && "[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*")
  22. [[ -z $iptry ]] && iptry=$lofplay
  23. sudo iptables -t nat -A OUTPUT -d $iptry -j DNAT --to $ipserv
  24. echo "$iptry"
  25.  
  26. appconect()
  27.  
  28. sudo iptables -t nat -D OUTPUT -d $iptry -j DNAT --to $ipserv
  29. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement