Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Auto-update signature

  1. Oct 16, 2006 #1

    0rthodontist

    User Avatar
    Science Advisor

    I just learned Python a little while ago and I'd like to write a script that will change my signature periodically (from a preset list). I don't have much experience with this type of programming. Anyway, I ran Ethereal and captured the packet that changes my sig, and then I tried to resend the packet with the signature slightly changed. This is the packet I captured (I have x'd my password out, hopefully there's nothing else in here that should also be x'd out, please tell me if there is!):
    Code (Text):

    0000  50 4f 53 54 20 2f 70 72  6f 66 69 6c 65 2e 70 68   POST /pr ofile.ph
    0010  70 20 48 54 54 50 2f 31  2e 31 0d 0a 55 73 65 72   p HTTP/1 .1..User
    0020  2d 41 67 65 6e 74 3a 20  4f 70 65 72 61 2f 39 2e   -Agent:  Opera/9.
    0030  30 30 20 28 57 69 6e 64  6f 77 73 20 4e 54 20 35   00 (Wind ows NT 5
    0040  2e 31 3b 20 55 3b 20 65  6e 29 0d 0a 48 6f 73 74   .1; U; e n)..Host
    0050  3a 20 70 68 79 73 69 63  73 66 6f 72 75 6d 73 2e   : physic sforums.
    0060  63 6f 6d 0d 0a 41 63 63  65 70 74 3a 20 74 65 78   com..Acc ept: tex
    0070  74 2f 68 74 6d 6c 2c 20  61 70 70 6c 69 63 61 74   t/html,  applicat
    0080  69 6f 6e 2f 78 6d 6c 3b  71 3d 30 2e 39 2c 20 61   ion/xml; q=0.9, a
    0090  70 70 6c 69 63 61 74 69  6f 6e 2f 78 68 74 6d 6c   pplicati on/xhtml
    00a0  2b 78 6d 6c 2c 20 69 6d  61 67 65 2f 70 6e 67 2c   +xml, im age/png,
    00b0  20 69 6d 61 67 65 2f 6a  70 65 67 2c 20 69 6d 61    image/j peg, ima
    00c0  67 65 2f 67 69 66 2c 20  69 6d 61 67 65 2f 78 2d   ge/gif,  image/x-
    00d0  78 62 69 74 6d 61 70 2c  20 2a 2f 2a 3b 71 3d 30   xbitmap,  */*;q=0
    00e0  2e 31 0d 0a 41 63 63 65  70 74 2d 4c 61 6e 67 75   .1..Acce pt-Langu
    00f0  61 67 65 3a 20 65 6e 5f  55 53 2c 65 6e 3b 71 3d   age: en_ US,en;q=
    0100  30 2e 39 0d 0a 41 63 63  65 70 74 2d 43 68 61 72   0.9..Acc ept-Char
    0110  73 65 74 3a 20 69 73 6f  2d 38 38 35 39 2d 31 2c   set: iso -8859-1,
    0120  20 75 74 66 2d 38 2c 20  75 74 66 2d 31 36 2c 20    utf-8,  utf-16,
    0130  2a 3b 71 3d 30 2e 31 0d  0a 41 63 63 65 70 74 2d   *;q=0.1. .Accept-
    0140  45 6e 63 6f 64 69 6e 67  3a 20 64 65 66 6c 61 74   Encoding : deflat
    0150  65 2c 20 67 7a 69 70 2c  20 78 2d 67 7a 69 70 2c   e, gzip,  x-gzip,
    0160  20 69 64 65 6e 74 69 74  79 2c 20 2a 3b 71 3d 30    identit y, *;q=0
    0170  0d 0a 52 65 66 65 72 65  72 3a 20 68 74 74 70 3a   ..Refere r: http:
    0180  2f 2f 70 68 79 73 69 63  73 66 6f 72 75 6d 73 2e   //physic sforums.
    0190  63 6f 6d 2f 70 72 6f 66  69 6c 65 2e 70 68 70 3f   com/prof ile.php?
    01a0  64 6f 3d 65 64 69 74 73  69 67 6e 61 74 75 72 65   do=edits ignature
    01b0  0d 0a 43 6f 6f 6b 69 65  3a 20 62 62 72 75 6c 65   ..Cookie : bbrule
    01c0  73 5b 32 5d 3d 32 3b 20  62 62 75 73 65 72 69 64   s[2]=2;  bbuserid
    01d0  3d 34 34 37 38 38 3b 20  62 62 70 61 73 73 77 6f   =44788;  bbpasswo
    01e0  72 64 xx xx xx xx xx xx  xx xx xx xx xx xx xx xx   rd=xxxxx xxxxxxxx
    01f0  xx xx xx xx xx xx xx xx  xx xx xx xx xx xx xx xx   xxxxxxxx xxxxxxxx
    0200  38 37 66 3b 20 62 62 72  75 6c 65 73 5b 35 5d 3d   xxx; bbr ules[5]=
    0210  35 3b 20 62 62 6c 61 73  74 76 69 73 69 74 3d 31   5; bblas tvisit=1
    0220  31 35 33 31 30 37 30 33  31 3b 20 62 62 6c 61 73   15310703 1; bblas
    0230  74 61 63 74 69 76 69 74  79 3d 30 3b 20 62 62 73   tactivit y=0; bbs
    0240  65 73 73 69 6f 6e 68 61  73 68 3d 63 66 38 31 39   essionha sh=cf819
    0250  63 34 37 62 36 34 31 34  30 62 33 39 39 62 61 65   c47b6414 0b399bae
    0260  36 37 37 39 63 39 37 64  66 61 37 3b 20 62 62 66   6779c97d fa7; bbf
    0270  6f 72 75 6d 5f 76 69 65  77 3d 31 38 32 65 39 66   orum_vie w=182e9f
    0280  30 65 64 64 61 63 33 35  31 66 64 39 63 65 61 65   0eddac35 1fd9ceae
    0290  31 65 32 30 36 38 33 33  65 32 61 2d 31 2d 25 37   1e206833 e2a-1-%7
    02a0  42 69 2d 31 36 35 5f 69  2d 31 31 36 30 39 36 39   Bi-165_i -1160969
    02b0  38 30 37 5f 25 37 44 3b  20 62 62 74 68 72 65 61   807_%7D;  bbthrea
    02c0  64 5f 6c 61 73 74 76 69  65 77 3d 38 38 65 38 32   d_lastvi ew=88e82
    02d0  63 64 32 37 33 31 62 35  64 63 36 30 36 63 64 36   cd2731b5 dc606cd6
    02e0  64 65 31 36 34 30 39 66  65 33 34 61 2d 34 2d 25   de16409f e34a-4-%
    02f0  37 42 69 2d 31 33 38 35  30 34 5f 69 2d 31 31 36   7Bi-1385 04_i-116
    0300  30 39 36 38 36 38 35 5f  69 2d 31 33 38 35 34 39   0968685_ i-138549
    0310  5f 69 2d 31 31 36 30 39  37 31 30 32 33 5f 69 2d   _i-11609 71023_i-
    0320  31 33 38 35 34 32 5f 69  2d 31 31 36 30 39 36 38   138542_i -1160968
    0330  35 30 30 5f 69 2d 31 33  38 35 32 31 5f 69 2d 31   500_i-13 8521_i-1
    0340  31 36 30 39 37 30 30 32  36 5f 25 37 44 0d 0a 43   16097002 6_%7D..C
    0350  6f 6f 6b 69 65 32 3a 20  24 56 65 72 73 69 6f 6e   ookie2:  $Version
    0360  3d 31 0d 0a 43 6f 6e 6e  65 63 74 69 6f 6e 3a 20   =1..Conn ection:
    0370  4b 65 65 70 2d 41 6c 69  76 65 2c 20 54 45 0d 0a   Keep-Ali ve, TE..
    0380  54 45 3a 20 64 65 66 6c  61 74 65 2c 20 67 7a 69   TE: defl ate, gzi
    0390  70 2c 20 63 68 75 6e 6b  65 64 2c 20 69 64 65 6e   p, chunk ed, iden
    03a0  74 69 74 79 2c 20 74 72  61 69 6c 65 72 73 0d 0a   tity, tr ailers..
    03b0  43 6f 6e 74 65 6e 74 2d  4c 65 6e 67 74 68 3a 20   Content- Length:
    03c0  32 37 35 0d 0a 43 6f 6e  74 65 6e 74 2d 54 79 70   275..Con tent-Typ
    03d0  65 3a 20 61 70 70 6c 69  63 61 74 69 6f 6e 2f 78   e: appli cation/x
    03e0  2d 77 77 77 2d 66 6f 72  6d 2d 75 72 6c 65 6e 63   -www-for m-urlenc
    03f0  6f 64 65 64 0d 0a 0d 0a  6d 65 73 73 61 67 65 3d   oded.... message=
    0400  53 61 67 69 74 74 61 72  69 75 73 2b 4e 6f 76 65   Sagittar ius+Nove
    0410  6d 62 65 72 2b 32 32 2b  2d 2b 44 65 63 65 6d 62   mber+22+ -+Decemb
    0420  65 72 2b 32 31 25 33 41  2e 25 30 44 25 30 41 25   er+21%3A .%0D%0A%
    0430  30 44 25 30 41 59 6f 75  2b 62 65 6c 69 65 76 65   0D%0AYou +believe
    0440  64 2b 62 65 69 6e 67 2b  73 74 72 61 6e 64 65 64   d+being+ stranded
    0450  2b 6f 6e 2b 74 68 61 74  2b 64 65 73 65 72 74 2b   +on+that +desert+
    0460  69 73 6c 61 6e 64 2b 70  75 74 2b 61 6e 2b 65 6e   island+p ut+an+en
    0470  64 2b 74 6f 2b 79 6f 75  72 2b 72 75 6e 2b 6f 66   d+to+you r+run+of
    0480  2b 6c 6f 75 73 79 2b 6c  75 63 6b 25 32 43 2b 62   +lousy+l uck%2C+b
    0490  75 74 2b 74 68 65 2b 6e  61 74 69 76 65 73 2b 77   ut+the+n atives+w
    04a0  69 6c 6c 2b 73 6f 6f 6e  2b 62 65 63 6f 6d 65 2b   ill+soon +become+
    04b0  73 74 72 61 6e 67 65 6c  79 2b 69 6e 73 70 69 72   strangel y+inspir
    04c0  65 64 2b 61 6e 64 2b 66  61 73 68 69 6f 6e 2b 61   ed+and+f ashion+a
    04d0  2b 63 72 75 64 65 2b 62  75 73 2b 74 6f 2b 68 69   +crude+b us+to+hi
    04e0  74 2b 79 6f 75 2b 77 69  74 68 2e 26 77 79 73 69   t+you+wi th.&wysi
    04f0  77 79 67 3d 30 26 73 3d  26 64 6f 3d 75 70 64 61   wyg=0&s= &do=upda
    0500  74 65 73 69 67 6e 61 74  75 72 65                  tesignat ure
     
    So I sent,
    EDIT: Hmm, this is very strange. I can't seem to post this particular code; when I click save changes it does not save. Too long a post? I'll just describe it. I sent
    conn = httplib.HTTPConnection("physicsforums.com")
    conn.request("POST","/profile.php",message)
    where message is the contents of the plain text column on the right of the packet description above, with the spaces taken out, with the leading POST /profile.php stripped off, and with the signature text altered.

    However I got back HTTP 403 Forbidden. A step up from a completely malformed request, but what am I doing wrong? Is the site set up so that this won't work? (Also, is this activity prohibited? If I get it working I'd like to update maybe once per half hour, not planning on hogging bandwidth)
     
    Last edited: Oct 16, 2006
  2. jcsd
  3. Oct 17, 2006 #2

    0rthodontist

    User Avatar
    Science Advisor

    On closer inspection, what I was sending was malformed; most of it got classed as "Data" instead of properly parsed when I look at it in Ethereal. The information sent was slightly different, with Python specifying things like the encoding for me that I was trying to specify myself. My question is:
    --How can I send an HTTP packet containing exactly the bytes I specify, from the method to the text data and everything in between?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Auto-update signature
  1. Prescott Update (Replies: 0)

  2. Auto Swith-On (Replies: 6)

  3. Updates are Irritating (Replies: 4)

  4. Updating miktex (Replies: 0)

  5. Digital Signatures ? (Replies: 10)

Loading...