Guest User

ovpn log

a guest
May 30th, 2016
24
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. TITLE   OpenVPN 2.3.6 x86_64-redhat-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [PKCS11] [MH] [IPv6] built on Dec  2 2014
  3. TIME    Wed May 25 15:05:08 2016    1464199508
  4. HEADER  CLIENT_LIST Common Name Real Address    Virtual Address Bytes Received  Bytes Sent  Connected Since Connected Since (time_t)    Username
  5. CLIENT_LIST orion-01889596000195    177.43.212.110:28763    172.16.191.145  872199  860412  Wed May 25 07:22:52 2016    1464171772  UNDEF
  6. CLIENT_LIST elgin-05997632000195    189.10.58.244:62588 172.16.6.210    301365  250459  Wed May 25 07:01:37 2016    1464170497  UNDEF
  7. CLIENT_LIST databits-13031005000123 187.17.235.203:50515    172.16.136.217  459833  409771  Wed May 25 06:09:01 2016    1464167341  UNDEF
  8. CLIENT_LIST UNDEF   201.14.8.164:1134       42  54  Wed May 25 15:05:07 2016    1464199507  UNDEF
  9. CLIENT_LIST elgin-15259334000151    187.5.4.138:56256   172.16.19.10    172756  170025  Wed May 25 08:26:39 2016    1464175599  UNDEF
  10. CLIENT_LIST open-14297962000169 189.27.214.176:53266    172.16.191.73   339724  293760  Wed May 25 08:56:44 2016    1464177404  UNDEF
  11. CLIENT_LIST proficio-13441178000110 179.213.177.117:49751   172.16.196.93   1083595 945154  Tue May 24 21:36:21 2016    1464136581  UNDEF
  12. CLIENT_LIST ne-10404496000201-pdv2  177.96.93.80:55161  172.16.9.82 188704  187305  Wed May 25 07:57:48 2016    1464173868  UNDEF
  13. CLIENT_LIST suprimate-01075580000149    187.45.79.185:1031  172.16.203.133  529298  521955  Wed May 25 06:30:38 2016    1464168638  UNDEF
  14. CLIENT_LIST centersystem-08926273000173 177.7.217.96:30721  172.16.134.165  1208231 1049827 Tue May 24 14:37:04 2016    1464111424  UNDEF
  15. CLIENT_LIST sonaglio-04991306000108 179.211.242.240:63653   172.16.7.174    413439  363969  Wed May 25 07:57:25 2016    1464173845  UNDEF
  16. CLIENT_LIST nd-09815412000154   186.208.216.77:58423    172.16.186.249  248929  204482  Wed May 25 08:48:55 2016    1464176935  UNDEF
  17. CLIENT_LIST xpert-08965723000137    179.236.106.107:60047   172.16.209.97   2704576 2334226 Mon May 23 13:59:23 2016    1464022763  UNDEF
  18. CLIENT_LIST klotz-03626094001330    168.0.4.24:27007    172.16.183.97   681730  486133  Wed May 25 06:30:52 2016    1464168652  UNDEF
  19. */
  20.  
  21. // Meu código, onde log.txt é um arquivo que contém 2000 linhas no mesmo modelo das acima
  22. // E essa imagem é o resultado que estou obtendo: https://snag.gy/56RBhX.jpg
  23.  
  24. $log = "log.txt";
  25. $handle = fopen("$log", "r");
  26.  
  27. $inclients = false;
  28. $cdata = array();
  29.  
  30. while (!feof($handle))
  31. {
  32.   $line = fgets($handle, 4096);
  33.  
  34.   if (substr($line, 0, 11) == "CLIENT_LIST")
  35.   {
  36.     $inclients = true;
  37.   }
  38.  
  39.   if ($inclients)
  40.   {
  41.     preg_match("/CLIENT_LIST(.*)UNDEF/", $line, $conteudo);
  42.  
  43.     $partes = preg_split("/\s{2,}/", trim($conteudo[1]));
  44.     echo var_dump($partes);
  45.   }
  46. }
RAW Paste Data