Menu

Download OB 1

mateuszk87
2014-10-08
2014-10-13
  • mateuszk87

    mateuszk87 - 2014-10-08

    I am trying to upload OB 1 from the PLC and then downloading the same code to the same PLC (also OB 1). Unfortunately it is not working or I did not understand the full upload and download functions :( (I am using python-snap7)

    #Uploading code from PLC
    poe_block = self.client.full_upload("OB", 1)
    block_size = poe_block[1]
    total_code = poe_block[0][:block_size] #take only block size amount of bytes
    
    #now the same code is downloaded again
    self.client.download(data=total_code, block_num=1)
    
    #My console output:
    
    INFO:snap7.client:creating snap7 client
    INFO:snap7.client:connecting to 192.168.200.199:102 rack 0 slot 0
    DEBUG:snap7.client:setting param number 2 to 102
    DEBUG:snap7.common:error text for 0x1b00000
    ERROR:snap7.common:CPU : block insert refused
    Traceback (most recent call last):
      File "/Users/mateusz/ics_payload_generator/fusabot/test.py", line 12, in 
        print attacker.upload_mc7_code('/Users/mateusz/ics_payload_generator/showcase/current3.mc7', 1)
      File "/Users/mateusz/ics_payload_generator/fusabot/attacks/attacker.py", line 76, in upload_mc7_code
        return self.client.download(data=mc7_block, block_num=block_number)
      File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/snap7/client.py", line 21, in f
        check_error(code, context="client")
      File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/snap7/common.py", line 65, in check_error
        raise Snap7Exception(error)
    snap7.snap7exceptions.Snap7Exception: CPU : block insert refused
    
     

    Last edit: mateuszk87 2014-10-08
  • Davide Nardella

    Davide Nardella - 2014-10-08

    Why are you connecting with Rack=0 and slot=0, is it a S71200/1500 ?

     
    • mateuszk87

      mateuszk87 - 2014-10-08

      Thanks for your fast reply.

      Good point! I changed it to rack=0, slot=2 (S7-300)

      INFO:snap7.client:creating snap7 client
      INFO:snap7.client:connecting to 192.168.200.199:102 rack 0 slot 2
      DEBUG:snap7.client:setting param number 2 to 102

      Still I get the same error :(

      EBUG:snap7.common:error text for 0x1b00000
      ERROR:snap7.common:CPU : block insert refused

       

      Last edit: mateuszk87 2014-10-09
  • Davide Nardella

    Davide Nardella - 2014-10-13

    All errors of type "CPU : blablabla" come directly from the PLC.

    This error means that the download sequence was accomplished but the CPU refused the Block insertion.

    This can happen if the cpu selector is on "run" (instead of "run/p" or "Stop") or because there is a protection level set.

    Try to run ClientDemo (from rich-demos/<your platform=""> folder) and look at the group "security".

     

Log in to post a comment.