Is there light at the end

xulit77 fromclay at maxitec.co.za
Wed Sep 4 03:31:45 EDT 2002


 Could someone please help me with this?

> Im really new to any kind of programming and the people at python.org
> return my messages in some other code :not python(lol)The people there are
> cool I just dont seem to understand there answers.If posible would you be
> able to answer in detail.
>
> is it wrong of me to send the ppp.log file to just anyone?
>
> HERE IS WHAT I HAVE:
>
> import re
> import string
>
> secondsMatcher=re.compile("Connect time: (\d+) secs")
>
> def getStuff(file):
>     closeline = 0
>     errorcount = 0
>     secondscount = 0
>     connectcount = 0
>     data_outcount = 0
     data_incount = 0
     ppplist = file.readlines()

     for line in ppplist:

       if string.find(line,"LayerUp") >= 0:
           print "found connect"
           connectline = string.split(line)
           connectcount = connectcount + 1

       elif string.find(line,"ERROR") >= 0:
           print "found error"
           errorcount = errorcount + 1

        elif string.find(line,"Connect time") >= 0:
           print "found close"
connectSecs=secondsMatcher.search(line).group(1)
           print "Connected for",connectSecs
          closeline = string.split(line)
           secondscount = secondscount + string.atoi(connectSecs)

 def main():
    f=open("C:/my documents/ppp.log","r")
     getStuff(f)
     return None

 if __name__=="__main__":
     main()

 THIS IS WHAT I NEED THE PROGRAM TO DO:

 I want the program to read the attached ppp.log file and give me the
 following type of report:


 PPP Log file summary for 5 Jul 2002
 -----------------------------------
 Jul  5 18:15:01 Connected to internet (IP 155.239.150.146)
 Jul  5 18:18:08 Closed connection. ( Connect time: 197 secs: 5091 octets
in,
 1864 octets out )
 -----------------------------------
 Successful connections: 5
 Failed connections: 2
 Total time online: 456 seconds Total data in: 66576 octets
 Total Data out: 66349 octets

HERE IS part of the olg file seems noone wants to touch the Attachment(lol)

> Jul  5 18:00:00 maxigate newsyslog[87300]: logfile turned over
Jul  5 18:15:00 maxigate ppp[34607]: tun0: Phase: Connected to local client.
Jul  5 18:15:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: quit
Jul  5 18:15:00 maxigate ppp[34607]: tun0: Phase: /var/run/internet: Client
connection dropped.
Jul  5 18:15:00 maxigate ppp[34607]: tun0: Phase: Connected to local client.
Jul  5 18:15:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: set
timeout 180
Jul  5 18:15:00 maxigate ppp[34607]: tun0: Command: /var/run/internet: dial
Jul  5 18:15:00 maxigate ppp[34607]: tun0: Phase: bundle: Establish
Jul  5 18:15:00 maxigate ppp[34607]: tun0: Phase: deflink: closed -> opening
Jul  5 18:15:00 maxigate ppp[34607]: tun0: Phase: deflink: Connected!
Jul  5 18:15:00 maxigate ppp[34607]: tun0: Phase: deflink: opening -> dial
Jul  5 18:15:00 maxigate ppp[34607]: tun0: Chat: Phone: 0860007249
Jul  5 18:15:00 maxigate ppp[34607]: tun0: Chat: deflink: Dial attempt 1 of
1
Jul  5 18:15:00 maxigate ppp[34607]: tun0: Phase: /var/run/internet: Client
connection closed.
Jul  5 18:15:00 maxigate ppp[34607]: tun0: Chat: Send: AT^M
Jul  5 18:15:00 maxigate ppp[34607]: tun0: Chat: Expect(5): OK
Jul  5 18:15:00 maxigate ppp[34607]: tun0: Chat: Received: AT^M^M
Jul  5 18:15:01 maxigate ppp[34607]: tun0: Chat: Received: OK^M
Jul  5 18:15:01 maxigate ppp[34607]: tun0: Chat: Send: ATE1Q0^M
Jul  5 18:15:01 maxigate ppp[34607]: tun0: Chat: Expect(5): OK
Jul  5 18:15:01 maxigate ppp[34607]: tun0: Chat: Received: ATE1Q0^M^M
Jul  5 18:15:01 maxigate ppp[34607]: tun0: Chat: Received: OK^M
Jul  5 18:15:01 maxigate ppp[34607]: tun0: Chat: Send: ATx1DT0860007249^M
Jul  5 18:15:03 maxigate ppp[34607]: tun0: Chat: Expect(40): CONNECT
Jul  5 18:15:22 maxigate ppp[34607]: tun0: Chat: Received:
ATx1DT0860007249^M^M
Jul  5 18:15:22 maxigate ppp[34607]: tun0: Chat: Received: CONNECT
33600/ARQ/V34/LAPM/V42BIS^M
Jul  5 18:15:22 maxigate ppp[34607]: tun0: Phase: deflink: dial -> carrier
Jul  5 18:15:23 maxigate ppp[34607]: tun0: Phase: deflink: /dev/cuaa0: CD
detected
Jul  5 18:15:23 maxigate ppp[34607]: tun0: Phase: deflink: carrier -> login
Jul  5 18:15:23 maxigate ppp[34607]: tun0: Phase: deflink: login -> lcp
Jul  5 18:15:23 maxigate ppp[34607]: tun0: LCP: FSM: Using "deflink" as a
transport
Jul  5 18:15:23 maxigate ppp[34607]: tun0: LCP: deflink: State change
Initial --> Closed
Jul  5 18:15:23 maxigate ppp[34607]: tun0: LCP: deflink: State change
Closed --> Stopped
Jul  5 18:15:24 maxigate ppp[34607]: tun0: LCP: deflink: LayerStart
Jul  5 18:15:24 maxigate ppp[34607]: tun0: LCP: deflink: SendConfigReq(179)
state = Stopped
Jul  5 18:15:24 maxigate ppp[34607]: tun0: LCP:  ACFCOMP[2]
Jul  5 18:15:24 maxigate ppp[34607]: tun0: LCP:  PROTOCOMP[2]
Jul  5 18:15:24 maxigate ppp[34607]: tun0: LCP:  ACCMAP[6] 0x00000000
Jul  5 18:15:24 maxigate ppp[34607]: tun0: LCP:  MRU[4] 1500
Jul  5 18:15:2






More information about the Python-list mailing list