centos 6.5 - running hexdump
$ hexdump -C filecsv
00000000 44 4f 53 2c 20 50 61 74 69 65 6e 74 2c 20 41 63 |DOS, Patient, Ac|
00000010 63 74 20 23 2c 20 4d 52 20 23 2c 20 54 69 6d 65 |ct #, MR #, Time|
Love this format but want hex to be converted to decimal
I have spent time looking but cannot find this?
hexdump supports specifying a format string via the -e command-line option, and it seems to be pretty flexible.
Example:
$ hexdump -C b.c
00000000 23 69 6e 63 6c 75 64 65 20 3c 73 74 64 69 6f 2e |#include <stdio.|
00000010 68 3e 0a 69 6e 74 20 6d 61 69 6e 28 29 7b 0a 20 |h>.int main(){. |
00000020 20 70 72 69 6e 74 66 28 22 68 65 6c 6c 6f 20 77 | printf("hello w|
00000030 6f 72 6c 64 5c 6e 22 29 3b 0a 20 20 72 65 74 75 |orld\n");. retu|
00000040 72 6e 20 30 3b 0a 7d 0a |rn 0;.}.|
00000048
$ hexdump -e'"%07.8_ax " 8/1 "%02x " " " 8/1 "%02x " " |"' -e'16/1 "%_p" "|\n"' b.c
00000000 23 69 6e 63 6c 75 64 65 20 3c 73 74 64 69 6f 2e |#include <stdio.|
00000010 68 3e 0a 69 6e 74 20 6d 61 69 6e 28 29 7b 0a 20 |h>.int main(){. |
00000020 20 70 72 69 6e 74 66 28 22 68 65 6c 6c 6f 20 77 | printf("hello w|
00000030 6f 72 6c 64 5c 6e 22 29 3b 0a 20 20 72 65 74 75 |orld\n");. retu|
00000040 72 6e 20 30 3b 0a 7d 0a |rn 0;.}.|
$ hexdump -e'"%07.8_ad " 8/1 "%03d " " " 8/1 "%03d " " |"' -e'16/1 "%_p" "|\n"' b.c
00000000 035 105 110 099 108 117 100 101 032 060 115 116 100 105 111 046 |#include <stdio.|
00000016 104 062 010 105 110 116 032 109 097 105 110 040 041 123 010 032 |h>.int main(){. |
00000032 032 112 114 105 110 116 102 040 034 104 101 108 108 111 032 119 | printf("hello w|
00000048 111 114 108 100 092 110 034 041 059 010 032 032 114 101 116 117 |orld\n");. retu|
00000064 114 110 032 048 059 010 125 010 |rn 0;.}.|
Not sure about how to reproduce that last line produced by -C.
See here for more details.
Related
Im trying to view the data being written to an HTTP socket using strace
However, although I have given -e write=all, I still cannot see all the data being written
strace -o /tmp/capture.log -p <pid> -e trace=all -e write=all -e read=all -f -tt
..
29620 16:09:14.723120 write(1899, "POST /task/native.wsdl HTTP/1.1\r"..., 210) = 210
29620 16:09:14.723319 write(1899, "<soap:Envelope xmlns:soap=\"http:"..., 450) = 450
What is strange is that, it shows the complete data during some other writes to other sockets
31145 16:09:28.110571 write(359, "POST /task/native.wsdl HTTP/1.1\r"..., 210) = 210
| 00000 50 4f 53 54 20 2f 74 61 73 6b 2f 6e 61 74 69 76 POST /task/nativ |
| 00010 65 2e 77 73 64 6c 20 48 54 54 50 2f 31 2e 31 0d e.wsdl HTTP/1.1. |
| 00020 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 74 .Content-Type: t |
| 00030 65 78 74 2f 78 6d 6c 3b 20 63 68 61 72 73 65 74 ext/xml; charset |
| 00040 3d 55 54 46 2d 38 0d 0a 41 63 63 65 70 74 3a 20 =UTF-8..Accept: |
| 00050 2a 2f 2a 0d 0a 53 4f 41 50 41 63 74 69 6f 6e 3a */*..SOAPAction: |
| 00060 20 22 22 0d 0a 55 73 65 72 2d 41 67 65 6e 74 3a ""..User-Agent: |
| 00070 20 41 70 61 63 68 65 20 43 58 46 20 32 2e 37 2e Apache CXF 2.7. |
| 00080 31 31 0d 0a 48 6f 73 74 3a 20 65 73 2d 73 76 63 11..Host: es-svc |
| 00090 73 2e 69 74 2e 61 74 74 2e 63 6f 6d 3a 37 30 30 s.it.att.com:700 |
| 000a0 33 0d 0a 43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 4b 3..Connection: K |
| 000b0 65 65 70 2d 41 6c 69 76 65 0d 0a 43 6f 6e 74 65 eep-Alive..Conte |
| 000c0 6e 74 2d 4c 65 6e 67 74 68 3a 20 34 35 30 0d 0a nt-Length: 450.. |
| 000d0 0d 0a .. |
Can somebody please explain. Is it possible to get data from all writes
The strace -e write=a,b flag shows write syscalls for file descriptors numbered from a to b, and -e write=all shows write syscalls to all file descriptors.
What you're looking for is -e abbrev=none; see the manpage:
-e abbrev=set
Abbreviate the output from printing each member of large structures.
The default is abbrev=all. The -v option has the effect of abbrev=none.
I am trying to add a new peer into the existing organization org1.example.com
I followed the steps mentioned in this tutorial
https://medium.com/#wahabjawed/extending-hyperledger-fabric-network-adding-a-new-peer-4f52f70a7217
I installed the chaincode on existing network before adding a new peer
I then changed the count of peers of org1.example.com from 2 to 3. Then I executed the following command:
cryptogen extend --input="crypto-config" --config=crypto-config.yaml
The output of this command was nothing.
Then I bootstrap the new peer with the following docker-compose configuration file:
version: '2'
volumes:
peer2.org1.example.com:
networks:
byfn:
services:
couchdb4:
container_name: couchdb4
image: hyperledger/fabric-couchdb
# Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password
# for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode.
environment:
- COUCHDB_USER=
- COUCHDB_PASSWORD=
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
# for example map it to utilize Fauxton User Interface in dev environments.
ports:
- "5988:5984"
networks:
- byfn
peer2.org1.example.com:
container_name: peer2.org1.example.com
extends:
file: peer-base.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer2.org1.example.com
- CORE_PEER_ADDRESS=peer2.org1.example.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer2.org1.example.com:7051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb4:5984
- CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=
- CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/org1.example.com/peers/peer2.org1.example.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/org1.example.com/peers/peer2.org1.example.com/tls:/etc/hyperledger/fabric/tls
- peer2.org1.example.com:/var/hyperledger/production
ports:
- 11051:7051
- 11053:7053
networks:
- byfn
But the logs keep showing:
peer2.org1.example.com | 2018-11-15 17:51:38.952 UTC [gossip/gossip] handleMessage -> WARN 5bf Message GossipMessage: tag:EMPTY alive_msg:<membership:<endpoint:"peer0.org2.example.com:7051" pki_id:"\316\347\246\2250\0171\025\221\"=\266|V\037$ \265\213\037\220z`\303\351\257\001\017\216\370J>" > timestamp:<inc_num:1542303654280601328 seq_num:736 > > , Envelope: 84 bytes, Signature: 71 bytes isn't valid
peer2.org1.example.com | 2018-11-15 17:51:38.952 UTC [gossip/gossip] handleMessage -> WARN 5c0 Message GossipMessage: tag:EMPTY alive_msg:<membership:<endpoint:"peer0.org2.example.com:7051" pki_id:"\316\347\246\2250\0171\025\221\"=\266|V\037$ \265\213\037\220z`\303\351\257\001\017\216\370J>" > timestamp:<inc_num:1542303654280601328 seq_num:736 > > , Envelope: 84 bytes, Signature: 71 bytes isn't valid
peer2.org1.example.com | 2018-11-15 17:51:39.123 UTC [gossip/gossip] handleMessage -> WARN 5c1 Message GossipMessage: tag:EMPTY alive_msg:<membership:<endpoint:"peer1.org2.example.com:7051" pki_id:"\262>\03566\350\330~\374\215(#\323\375\331\317\234%,\215-\024\316O\327v}\005\263\374\\\224" > timestamp:<inc_num:1542303654503183827 seq_num:738 > > , Envelope: 84 bytes, Signature: 71 bytes isn't valid
peer2.org1.example.com | 2018-11-15 17:51:39.124 UTC [gossip/gossip] handleMessage -> WARN 5c2 Message GossipMessage: tag:EMPTY alive_msg:<membership:<endpoint:"peer1.org2.example.com:7051" pki_id:"\262>\03566\350\330~\374\215(#\323\375\331\317\234%,\215-\024\316O\327v}\005\263\374\\\224" > timestamp:<inc_num:1542303654503183827 seq_num:738 > > , Envelope: 84 bytes, Signature: 71 bytes isn't valid
peer2.org1.example.com | 2018-11-15 17:51:40.103 UTC [peer/gossip/mcs] Verify -> ERRO 5c3 Failed getting validated identity from peer identity [Peer Identity [0a 07 4f 72 67 32 4d 53 50 12 a6 06 2d 2d 2d 2d 2d 42 45 47 49 4e 20 43 45 52 54 49 46 49 43 41 54 45 2d 2d 2d 2d 2d 0a 4d 49 49 43 4a 7a 43 43 41 63 36 67 41 77 49 42 41 67 49 51 46 54 76 55 43 2b 6a 78 6a 32 50 4e 63 41 48 33 45 61 45 68 4d 7a 41 4b 42 67 67 71 68 6b 6a 4f 50 51 51 44 41 6a 42 7a 4d 51 73 77 0a 43 51 59 44 56 51 51 47 45 77 4a 56 55 7a 45 54 4d 42 45 47 41 31 55 45 43 42 4d 4b 51 32 46 73 61 57 5a 76 63 6d 35 70 59 54 45 57 4d 42 51 47 41 31 55 45 42 78 4d 4e 55 32 46 75 49 45 5a 79 0a 59 57 35 6a 61 58 4e 6a 62 7a 45 5a 4d 42 63 47 41 31 55 45 43 68 4d 51 62 33 4a 6e 4d 69 35 6c 65 47 46 74 63 47 78 6c 4c 6d 4e 76 62 54 45 63 4d 42 6f 47 41 31 55 45 41 78 4d 54 59 32 45 75 0a 62 33 4a 6e 4d 69 35 6c 65 47 46 74 63 47 78 6c 4c 6d 4e 76 62 54 41 65 46 77 30 78 4f 44 45 78 4d 54 55 78 4e 7a 4d 32 4d 44 42 61 46 77 30 79 4f 44 45 78 4d 54 49 78 4e 7a 4d 32 4d 44 42 61 0a 4d 47 6f 78 43 7a 41 4a 42 67 4e 56 42 41 59 54 41 6c 56 54 4d 52 4d 77 45 51 59 44 56 51 51 49 45 77 70 44 59 57 78 70 5a 6d 39 79 62 6d 6c 68 4d 52 59 77 46 41 59 44 56 51 51 48 45 77 31 54 0a 59 57 34 67 52 6e 4a 68 62 6d 4e 70 63 32 4e 76 4d 51 30 77 43 77 59 44 56 51 51 4c 45 77 52 77 5a 57 56 79 4d 52 38 77 48 51 59 44 56 51 51 44 45 78 5a 77 5a 57 56 79 4d 53 35 76 63 6d 63 79 0a 4c 6d 56 34 59 57 31 77 62 47 55 75 59 32 39 74 4d 46 6b 77 45 77 59 48 4b 6f 5a 49 7a 6a 30 43 41 51 59 49 4b 6f 5a 49 7a 6a 30 44 41 51 63 44 51 67 41 45 47 4d 4f 54 72 4b 35 48 5a 30 66 48 0a 43 6a 71 68 67 67 59 4e 30 6a 7a 39 5a 76 70 56 47 47 56 76 57 65 55 39 6b 33 4a 53 51 54 75 39 6f 6a 53 6d 6e 6e 44 30 4d 4d 55 77 50 4c 2b 4a 69 56 77 37 6d 55 30 51 71 42 44 64 4f 61 67 72 0a 69 78 48 39 54 47 78 37 4e 71 4e 4e 4d 45 73 77 44 67 59 44 56 52 30 50 41 51 48 2f 42 41 51 44 41 67 65 41 4d 41 77 47 41 31 55 64 45 77 45 42 2f 77 51 43 4d 41 41 77 4b 77 59 44 56 52 30 6a 0a 42 43 51 77 49 6f 41 67 50 75 6c 39 4e 37 6a 57 34 39 68 68 32 70 70 50 65 6f 52 54 2f 48 52 6b 4b 32 50 47 62 77 73 4b 35 58 41 6f 4f 57 45 4d 2b 44 6f 77 43 67 59 49 4b 6f 5a 49 7a 6a 30 45 0a 41 77 49 44 52 77 41 77 52 41 49 67 66 69 35 58 4a 58 4a 55 57 47 73 4b 5a 77 62 70 63 63 75 52 50 66 6c 31 4b 48 61 4b 44 42 30 69 2f 49 39 30 47 61 4d 72 55 6d 41 43 49 44 63 45 72 52 55 6e 0a 39 48 4c 66 73 45 55 6f 30 31 70 49 44 70 76 31 37 49 68 6f 43 4f 5a 6b 33 69 57 72 34 68 48 36 4a 78 79 30 0a 2d 2d 2d 2d 2d 45 4e 44 20 43 45 52 54 49 46 49 43 41 54 45 2d 2d 2d 2d 2d 0a] cannot be validated. No MSP found able to do that.]
peer2.org1.example.com | 2018-11-15 17:51:40.104 UTC [gossip/gossip] handleMessage -> WARN 5c4 Failed validating identity message: Peer Identity [0a 07 4f 72 67 32 4d 53 50 12 a6 06 2d 2d 2d 2d 2d 42 45 47 49 4e 20 43 45 52 54 49 46 49 43 41 54 45 2d 2d 2d 2d 2d 0a 4d 49 49 43 4a 7a 43 43 41 63 36 67 41 77 49 42 41 67 49 51 46 54 76 55 43 2b 6a 78 6a 32 50 4e 63 41 48 33 45 61 45 68 4d 7a 41 4b 42 67 67 71 68 6b 6a 4f 50 51 51 44 41 6a 42 7a 4d 51 73 77 0a 43 51 59 44 56 51 51 47 45 77 4a 56 55 7a 45 54 4d 42 45 47 41 31 55 45 43 42 4d 4b 51 32 46 73 61 57 5a 76 63 6d 35 70 59 54 45 57 4d 42 51 47 41 31 55 45 42 78 4d 4e 55 32 46 75 49 45 5a 79 0a 59 57 35 6a 61 58 4e 6a 62 7a 45 5a 4d 42 63 47 41 31 55 45 43 68 4d 51 62 33 4a 6e 4d 69 35 6c 65 47 46 74 63 47 78 6c 4c 6d 4e 76 62 54 45 63 4d 42 6f 47 41 31 55 45 41 78 4d 54 59 32 45 75 0a 62 33 4a 6e 4d 69 35 6c 65 47 46 74 63 47 78 6c 4c 6d 4e 76 62 54 41 65 46 77 30 78 4f 44 45 78 4d 54 55 78 4e 7a 4d 32 4d 44 42 61 46 77 30 79 4f 44 45 78 4d 54 49 78 4e 7a 4d 32 4d 44 42 61 0a 4d 47 6f 78 43 7a 41 4a 42 67 4e 56 42 41 59 54 41 6c 56 54 4d 52 4d 77 45 51 59 44 56 51 51 49 45 77 70 44 59 57 78 70 5a 6d 39 79 62 6d 6c 68 4d 52 59 77 46 41 59 44 56 51 51 48 45 77 31 54 0a 59 57 34 67 52 6e 4a 68 62 6d 4e 70 63 32 4e 76 4d 51 30 77 43 77 59 44 56 51 51 4c 45 77 52 77 5a 57 56 79 4d 52 38 77 48 51 59 44 56 51 51 44 45 78 5a 77 5a 57 56 79 4d 53 35 76 63 6d 63 79 0a 4c 6d 56 34 59 57 31 77 62 47 55 75 59 32 39 74 4d 46 6b 77 45 77 59 48 4b 6f 5a 49 7a 6a 30 43 41 51 59 49 4b 6f 5a 49 7a 6a 30 44 41 51 63 44 51 67 41 45 47 4d 4f 54 72 4b 35 48 5a 30 66 48 0a 43 6a 71 68 67 67 59 4e 30 6a 7a 39 5a 76 70 56 47 47 56 76 57 65 55 39 6b 33 4a 53 51 54 75 39 6f 6a 53 6d 6e 6e 44 30 4d 4d 55 77 50 4c 2b 4a 69 56 77 37 6d 55 30 51 71 42 44 64 4f 61 67 72 0a 69 78 48 39 54 47 78 37 4e 71 4e 4e 4d 45 73 77 44 67 59 44 56 52 30 50 41 51 48 2f 42 41 51 44 41 67 65 41 4d 41 77 47 41 31 55 64 45 77 45 42 2f 77 51 43 4d 41 41 77 4b 77 59 44 56 52 30 6a 0a 42 43 51 77 49 6f 41 67 50 75 6c 39 4e 37 6a 57 34 39 68 68 32 70 70 50 65 6f 52 54 2f 48 52 6b 4b 32 50 47 62 77 73 4b 35 58 41 6f 4f 57 45 4d 2b 44 6f 77 43 67 59 49 4b 6f 5a 49 7a 6a 30 45 0a 41 77 49 44 52 77 41 77 52 41 49 67 66 69 35 58 4a 58 4a 55 57 47 73 4b 5a 77 62 70 63 63 75 52 50 66 6c 31 4b 48 61 4b 44 42 30 69 2f 49 39 30 47 61 4d 72 55 6d 41 43 49 44 63 45 72 52 55 6e 0a 39 48 4c 66 73 45 55 6f 30 31 70 49 44 70 76 31 37 49 68 6f 43 4f 5a 6b 33 69 57 72 34 68 48 36 4a 78 79 30 0a 2d 2d 2d 2d 2d 45 4e 44 20 43 45 52 54 49 46 49 43 41 54 45 2d 2d 2d 2d 2d 0a] cannot be validated. No MSP found able to do that.
peer2.org1.example.com | Failed verifying message
peer2.org1.example.com | github.com/hyperledger/fabric/gossip/gossip.(*certStore).validateIdentityMsg
peer2.org1.example.com | /opt/gopath/src/github.com/hyperledger/fabric/gossip/gossip/certstore.go:103
peer2.org1.example.com | github.com/hyperledger/fabric/gossip/gossip.(*certStore).handleMessage
peer2.org1.example.com | /opt/gopath/src/github.com/hyperledger/fabric/gossip/gossip/certstore.go:75
peer2.org1.example.com | github.com/hyperledger/fabric/gossip/gossip.(*gossipServiceImpl).handleMessage
peer2.org1.example.com | /opt/gopath/src/github.com/hyperledger/fabric/gossip/gossip/gossip_impl.go:403
peer2.org1.example.com | github.com/hyperledger/fabric/gossip/gossip.(*gossipServiceImpl).acceptMessages
peer2.org1.example.com | /opt/gopath/src/github.com/hyperledger/fabric/gossip/gossip/gossip_impl.go:330
peer2.org1.example.com | runtime.goexit
peer2.org1.example.com | /opt/go/src/runtime/asm_amd64.s:2361
peer2.org1.example.com | github.com/hyperledger/fabric/gossip/gossip.(*certStore).handleMessage
peer2.org1.example.com | /opt/gopath/src/github.com/hyperledger/fabric/gossip/gossip/certstore.go:76
peer2.org1.example.com | github.com/hyperledger/fabric/gossip/gossip.(*gossipServiceImpl).handleMessage
peer2.org1.example.com | /opt/gopath/src/github.com/hyperledger/fabric/gossip/gossip/gossip_impl.go:403
peer2.org1.example.com | github.com/hyperledger/fabric/gossip/gossip.(*gossipServiceImpl).acceptMessages
peer2.org1.example.com | /opt/gopath/src/github.com/hyperledger/fabric/gossip/gossip/gossip_impl.go:330
peer2.org1.example.com | runtime.goexit
peer2.org1.example.com | /opt/go/src/runtime/asm_amd64.s:2361
I am using Hyperledger Fabric v1.3
Any help would be appreciated
The issue was fixed after new peer joined the channel. The error messages were not really helpful.
I'm trying to control my Panasonic TV via network. I had all my code (node) running from the laptop when I transferred it to the Raspberry. For some reason, it does not work from there. (A similar project controlling my Denon receiver works very well.)
By "Not Working", I mean, that the TV can be reached, but returns a 403 error. When TV is off, it's unreachable. So the Raspberry calls out to the TV.
I tried many different ways and eventually I'm working with a curl request. It works from everywhere, but not from the Raspberry:
curl 'http://192.168.178.142:55000/nrc/control_0' \
-H 'content-type: text/xml; charset="utf-8"' \
-H 'user-agent: net.thlabs.nodecontrol' \
-H 'soapaction: "urn:panasonic-com:service:p00NetworkControl:1#X_SendKey"' \
--data-binary '<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:X_SendKey xmlns:u="urn:panasonic-com:service:p00NetworkControl:1"><X_KeyEvent>NRC_MUTE-ONOFF</X_KeyEvent></u:X_SendKey></s:Body></s:Envelope>' \
--compressed
It does work from the Raspberry, if I proxy through any other device e.g. my laptop. However, it does not work, when I proxy from laptop through the Raspberry.
Trying for two days now, does anybody have a clue?
Edit: I reduced the curl even more: Without user-agent, content-type and compression this stilll works on any laptop (running windows, also tried WSL shell), but on my Raspberries (1+3, Rasbian and ArchLinux), I receive 403. When I additionally omit the soapaction I receive error 400 everywhere.
curl 'http://192.168.178.142:55000/nrc/control_0' \
-H 'soapaction: "urn:panasonic-com:service:p00NetworkControl:1#X_SendKey"' \
--data-binary '<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:X_SendKey xmlns:u="urn:panasonic-com:service:p00NetworkControl:1"><X_KeyEvent>NRC_MUTE-ONOFF</X_KeyEvent></u:X_SendKey></s:Body></s:Envelope>' \
-w '%{http_code}'
Update 1: verbose curl
curl -v ... result on Laptop:
* Hostname was NOT found in DNS cache
* Trying 192.168.178.142...
* Connected to 192.168.178.142 (192.168.178.142) port 55000 (#0)
> POST /nrc/control_0 HTTP/1.1
> User-Agent: curl/7.35.0
> Host: 192.168.178.142:55000
> Accept: */\*
> soapaction: "urn:panasonic-com:service:p00NetworkControl:1#X_SendKey"
> Content-Length: 314
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 314 out of 314 bytes
< HTTP/1.1 200 OK
< CONTENT-LENGTH: 301
< Content-Type: text/xml; charset="utf-8"
< EXT:
* Server Panasonic-VIErA/1, UPnP/1.0, Panasonic MIL DLNA SERVER is not blacklisted
< SERVER: Panasonic-VIErA/1, UPnP/1.0, Panasonic MIL DLNA SERVER
< CONNECTION: close
<
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:X_SendKeyResponse xmlns:u="urn:panasoniccom:service:p00NetworkControl:1"></u:X_SendKeyResponse>
</s:Body>
</s:Envelope>
* Closing connection 0
curl -v ... result on Raspberries:
* Hostname was NOT found in DNS cache
* Trying 192.168.178.142...
* Connected to 192.168.178.142 (192.168.178.142) port 55000 (#0)
> POST /nrc/control_0 HTTP/1.1
> User-Agent: curl/7.38.0
> Host: 192.168.178.142:55000
> Accept: */\*
> soapaction: "urn:panasonic-com:service:p00NetworkControl:1#X_SendKey"
> Content-Length: 314
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 314 out of 314 bytes
< HTTP/1.1 403 Forbidden
< CONNECTION: close
<
* Closing connection 0
Update 2: Traceroutes
On Windows Laptop (Powershell):
tracert 192.168.178.142
Routenverfolgung zu COM-MID1.fritz.box [192.168.178.142] über maximal 30 Hops:
1 4 ms 3 ms 3 ms COM-MID1.fritz.box [192.168.178.142]
On Raspberry Pi:
pi#raspberrypi:~ $ traceroute 192.168.178.142
traceroute to 192.168.178.142 (192.168.178.142), 30 hops max, 60 byte packets
1 COM-MID1.fritz.box (192.168.178.142) 4.545 ms 4.411 ms 4.347 ms
Update 3: HTTP Requests captured by Wireshark
From Laptop:
0000 c0 d9 62 53 1b 03 00 c2 c6 cd ce 81 08 00 45 00 ..bS..........E.
0010 02 52 00 08 40 00 80 06 12 7f c0 a8 b2 3f c0 a8 .R..#........?..
0020 b2 8e ff 53 d6 d8 9f 96 36 7f e1 55 0f 6c 50 18 ...S....6..U.lP.
0030 fa f0 4d 2d 00 00 50 4f 53 54 20 2f 6e 72 63 2f ..M-..POST /nrc/
0040 63 6f 6e 74 72 6f 6c 5f 30 20 48 54 54 50 2f 31 control_0 HTTP/1
0050 2e 31 0d 0a 55 73 65 72 2d 41 67 65 6e 74 3a 20 .1..User-Agent:
0060 63 75 72 6c 2f 37 2e 33 35 2e 30 0d 0a 48 6f 73 curl/7.35.0..Hos
0070 74 3a 20 31 39 32 2e 31 36 38 2e 31 37 38 2e 31 t: 192.168.178.1
0080 34 32 3a 35 35 30 30 30 0d 0a 41 63 63 65 70 74 42:55000..Accept
0090 3a 20 2a 2f 2a 0d 0a 73 6f 61 70 61 63 74 69 6f : *\*..soapactio
00a0 6e 3a 20 22 75 72 6e 3a 70 61 6e 61 73 6f 6e 69 n: "urn:panasoni
00b0 63 2d 63 6f 6d 3a 73 65 72 76 69 63 65 3a 70 30 c-com:service:p0
00c0 30 4e 65 74 77 6f 72 6b 43 6f 6e 74 72 6f 6c 3a 0NetworkControl:
00d0 31 23 58 5f 53 65 6e 64 4b 65 79 22 0d 0a 43 6f 1#X_SendKey"..Co
00e0 6e 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 33 31 ntent-Length: 31
00f0 34 0d 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 4..Content-Type:
0100 20 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 77 application/x-w
0110 77 77 2d 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 ww-form-urlencod
0120 65 64 0d 0a 0d 0a 3c 3f 78 6d 6c 20 76 65 72 73 ed....<?xml vers
0130 69 6f 6e 3d 22 31 2e 30 22 20 65 6e 63 6f 64 69 ion="1.0" encodi
0140 6e 67 3d 22 75 74 66 2d 38 22 3f 3e 3c 73 3a 45 ng="utf-8"?><s:E
0150 6e 76 65 6c 6f 70 65 20 78 6d 6c 6e 73 3a 73 3d nvelope xmlns:s=
0160 22 68 74 74 70 3a 2f 2f 73 63 68 65 6d 61 73 2e "http://schemas.
0170 78 6d 6c 73 6f 61 70 2e 6f 72 67 2f 73 6f 61 70 xmlsoap.org/soap
0180 2f 65 6e 76 65 6c 6f 70 65 2f 22 20 73 3a 65 6e /envelope/" s:en
0190 63 6f 64 69 6e 67 53 74 79 6c 65 3d 22 68 74 74 codingStyle="htt
01a0 70 3a 2f 2f 73 63 68 65 6d 61 73 2e 78 6d 6c 73 p://schemas.xmls
01b0 6f 61 70 2e 6f 72 67 2f 73 6f 61 70 2f 65 6e 63 oap.org/soap/enc
01c0 6f 64 69 6e 67 2f 22 3e 3c 73 3a 42 6f 64 79 3e oding/"><s:Body>
01d0 3c 75 3a 58 5f 53 65 6e 64 4b 65 79 20 78 6d 6c <u:X_SendKey xml
01e0 6e 73 3a 75 3d 22 75 72 6e 3a 70 61 6e 61 73 6f ns:u="urn:panaso
01f0 6e 69 63 2d 63 6f 6d 3a 73 65 72 76 69 63 65 3a nic-com:service:
0200 70 30 30 4e 65 74 77 6f 72 6b 43 6f 6e 74 72 6f p00NetworkContro
0210 6c 3a 31 22 3e 3c 58 5f 4b 65 79 45 76 65 6e 74 l:1"><X_KeyEvent
0220 3e 4e 52 43 5f 4d 55 54 45 2d 4f 4e 4f 46 46 3c >NRC_MUTE-ONOFF<
0230 2f 58 5f 4b 65 79 45 76 65 6e 74 3e 3c 2f 75 3a /X_KeyEvent></u:
0240 58 5f 53 65 6e 64 4b 65 79 3e 3c 2f 73 3a 42 6f X_SendKey></s:Bo
0250 64 79 3e 3c 2f 73 3a 45 6e 76 65 6c 6f 70 65 3e dy></s:Envelope>
From Raspberry:
0000 c0 d9 62 53 1b 03 b8 27 eb fb b4 2f 08 00 45 00 ..bS...'.../..E.
0010 02 5e 7a 2d 40 00 40 06 d8 6f c0 a8 b2 1d c0 a8 .^z-#.#..o......
0020 b2 8e ad e4 d6 d8 af d0 76 fc ef 51 f3 ed 80 18 ........v..Q....
0030 00 e5 6f 0b 00 00 01 01 08 0a 00 09 0c d0 76 94 ..o...........v.
0040 27 05 50 4f 53 54 20 2f 6e 72 63 2f 63 6f 6e 74 '.POST /nrc/cont
0050 72 6f 6c 5f 30 20 48 54 54 50 2f 31 2e 31 0d 0a rol_0 HTTP/1.1..
0060 55 73 65 72 2d 41 67 65 6e 74 3a 20 63 75 72 6c User-Agent: curl
0070 2f 37 2e 33 38 2e 30 0d 0a 48 6f 73 74 3a 20 31 /7.38.0..Host: 1
0080 39 32 2e 31 36 38 2e 31 37 38 2e 31 34 32 3a 35 92.168.178.142:5
0090 35 30 30 30 0d 0a 41 63 63 65 70 74 3a 20 2a 2f 5000..Accept: *\
00a0 2a 0d 0a 73 6f 61 70 61 63 74 69 6f 6e 3a 20 22 *..soapaction: "
00b0 75 72 6e 3a 70 61 6e 61 73 6f 6e 69 63 2d 63 6f urn:panasonic-co
00c0 6d 3a 73 65 72 76 69 63 65 3a 70 30 30 4e 65 74 m:service:p00Net
00d0 77 6f 72 6b 43 6f 6e 74 72 6f 6c 3a 31 23 58 5f workControl:1#X_
00e0 53 65 6e 64 4b 65 79 22 0d 0a 43 6f 6e 74 65 6e SendKey"..Conten
00f0 74 2d 4c 65 6e 67 74 68 3a 20 33 31 34 0d 0a 43 t-Length: 314..C
0100 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 70 70 ontent-Type: app
0110 6c 69 63 61 74 69 6f 6e 2f 78 2d 77 77 77 2d 66 lication/x-www-f
0120 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 65 64 0d 0a orm-urlencoded..
0130 0d 0a 3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e 3d ..<?xml version=
0140 22 31 2e 30 22 20 65 6e 63 6f 64 69 6e 67 3d 22 "1.0" encoding="
0150 75 74 66 2d 38 22 3f 3e 3c 73 3a 45 6e 76 65 6c utf-8"?><s:Envel
0160 6f 70 65 20 78 6d 6c 6e 73 3a 73 3d 22 68 74 74 ope xmlns:s="htt
0170 70 3a 2f 2f 73 63 68 65 6d 61 73 2e 78 6d 6c 73 p://schemas.xmls
0180 6f 61 70 2e 6f 72 67 2f 73 6f 61 70 2f 65 6e 76 oap.org/soap/env
0190 65 6c 6f 70 65 2f 22 20 73 3a 65 6e 63 6f 64 69 elope/" s:encodi
01a0 6e 67 53 74 79 6c 65 3d 22 68 74 74 70 3a 2f 2f ngStyle="http://
01b0 73 63 68 65 6d 61 73 2e 78 6d 6c 73 6f 61 70 2e schemas.xmlsoap.
01c0 6f 72 67 2f 73 6f 61 70 2f 65 6e 63 6f 64 69 6e org/soap/encodin
01d0 67 2f 22 3e 3c 73 3a 42 6f 64 79 3e 3c 75 3a 58 g/"><s:Body><u:X
01e0 5f 53 65 6e 64 4b 65 79 20 78 6d 6c 6e 73 3a 75 _SendKey xmlns:u
01f0 3d 22 75 72 6e 3a 70 61 6e 61 73 6f 6e 69 63 2d ="urn:panasonic-
0200 63 6f 6d 3a 73 65 72 76 69 63 65 3a 70 30 30 4e com:service:p00N
0210 65 74 77 6f 72 6b 43 6f 6e 74 72 6f 6c 3a 31 22 etworkControl:1"
0220 3e 3c 58 5f 4b 65 79 45 76 65 6e 74 3e 4e 52 43 ><X_KeyEvent>NRC
0230 5f 4d 55 54 45 2d 4f 4e 4f 46 46 3c 2f 58 5f 4b _MUTE-ONOFF</X_K
0240 65 79 45 76 65 6e 74 3e 3c 2f 75 3a 58 5f 53 65 eyEvent></u:X_Se
0250 6e 64 4b 65 79 3e 3c 2f 73 3a 42 6f 64 79 3e 3c ndKey></s:Body><
0260 2f 73 3a 45 6e 76 65 6c 6f 70 65 3e /s:Envelope>
Update 4: Files with captured packets
Laptop: https://drive.google.com/open?id=1P_uVc0ndGG37kizuFBZwApvQ-SePKbZd
RaspPi: https://drive.google.com/open?id=1V4-t3qi5TS8NpYeGqVXLo_zi8PxXbRnp
I have resolved the problem by resetting the factory parameters of my Panasonic TV. But I don't understand the root cause of the problem.
I have a file with what I believe to be a unicode type and would like to remove them with sed or some other unix utility. I have tried few options and for some reason unable to remove those characters. Test cases shown with single line (head -n1)
Attempt 1:
> head -n1 file1.txt | hexdump -C # Hexdump line 1
output:
00000000 47 72 6f 75 70 c2 a0 20 20 20 53 69 67 6e 61 6c |Group.. Signal|
00000010 c2 a0 6e 61 6d 65 c2 a0 20 20 20 20 20 20 20 20 |..name.. |
00000020 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
00000030 55 6e 69 74 c2 a0 20 74 79 70 65 c2 a0 44 65 73 |Unit.. type..Des|
00000040 63 72 69 70 74 69 6f 6e c2 a0 0d 0a |cription....|
0000004c
Now replace "c2 a0" above
> head -n1 file1.txt | sed 's/\xc2\xa0//g' | hexdump -C
or
> head -n1 file1.txt | sed 's/\x{c2a0}//g | hexdump -C
00000000 47 72 6f 75 70 c2 a0 20 20 20 53 69 67 6e 61 6c |Group.. Signal|
00000010 c2 a0 6e 61 6d 65 c2 a0 20 20 20 20 20 20 20 20 |..name.. |
00000020 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
00000030 55 6e 69 74 c2 a0 20 74 79 70 65 c2 a0 44 65 73 |Unit.. type..Des|
00000040 63 72 69 70 74 69 6f 6e c2 a0 0d 0a |cription....|
No replacements happend
Attempt 2: Using vim
vim file1.txt
:set nobomb
:set fileencoding=utf-8
:wq
Used sed again and no replacements happened. How do I replace or remove those characters (hex "c2a0")?
I finally ended up using Perl which successfully removed the unicode chars.
> perl -v
This is perl 5, version 18, subversion 2 (v5.18.2) built for darwin-thread-multi-2level
> perl -pi -e 's/\x{c2}\x{a0}//g' file1.txt
> head -n1 file1.txt | hexdump -C
00000000 47 72 6f 75 70 20 20 20 53 69 67 6e 61 6c 6e 61 |Group Signalna|
00000010 6d 65 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |me |
00000020 20 20 20 20 20 20 20 20 20 20 55 6e 69 74 20 74 | Unit t|
00000030 79 70 65 44 65 73 63 72 69 70 74 69 6f 6e 0d 0a |ypeDescription..|
00000040
I am going to try to write simple BitTorrent client. Of course I read http://wiki.theory.org/BitTorrentSpecification. I began by analyzing communication between two clients. I have problem with meaning of two fields - bold font in the following hexadecimal dump.
First packet send by Deluge to rTorrent:
00000000 13 |. | - protocol name length (1) - 0x13 = 19
00000000 42 69 74 54 6f 72 72 65 6e 74 20 70 72 6f 74 | BitTorrent prot| - protocol name (19)
00000010 6f 63 6f 6c |ocol |
00000010 00 00 00 00 00 18 00 05 | ........ | - reserved extension bytes (8)
00000010 ab 20 ef 66 | . .f| - info_hash (20)
00000020 c8 ee de 47 99 a2 75 40 20 75 ee 7b c6 4e 2f dd |...G..u# u.{.N/.|
00000030 2d 44 45 31 33 33 30 2d 42 6c 78 37 6c 69 7a 7e |-DE1330-Blx7liz~| - peer_id (20)
00000040 4a 54 2e 6a |JT.j| Deluge 1.3.3
Answer from rTorrent to Deluge:
00000000 13 |. | - protocol name length (1) - 0x13 = 19
00000000 42 69 74 54 6f 72 72 65 6e 74 20 70 72 6f 74 | BitTorrent prot| - protocol name (19)
00000010 6f 63 6f 6c |ocol |
00000010 00 00 00 00 00 10 00 00 | ........ | - reserved extension bytes (8)
00000010 ab 20 ef 66 | . .f| - info_hash (20)
00000020 c8 ee de 47 99 a2 75 40 20 75 ee 7b c6 4e 2f dd |...G..u# u.{.N/.|
00000030 2d 6c 74 30 43 39 30 2d b6 eb 22 ae 31 e3 89 90 |-lt0C90-..".1...| - peer_id (20)
00000040 2a 9b af a9 |*... | libTorrent (rakshasa) 0.12.9
00000040 00 00 00 6e | ...n | - message length? (4) - 0x6E = 110
00000040 14 00 | .. | - something (2) - message id?
00000040 64 31 3a 65 69 30 | d1:ei0| - bencoded dictionary (108)
00000050 65 31 3a 6d 64 31 31 3a 75 74 5f 6d 65 74 61 64 |e1:md11:ut_metad| { 'e': 0,
00000060 61 74 61 69 32 65 36 3a 75 74 5f 70 65 78 69 31 |atai2e6:ut_pexi1| 'metadata_size': 1702,
00000070 65 65 31 33 3a 6d 65 74 61 64 61 74 61 5f 73 69 |ee13:metadata_si| 'm': {'ut_metadata': 2, 'ut_pex': 1},
00000080 7a 65 69 31 37 30 32 65 31 3a 70 69 35 30 30 39 |zei1702e1:pi5009| 'reqq': 2048,
00000090 34 65 34 3a 72 65 71 71 69 32 30 34 38 65 31 3a |4e4:reqqi2048e1:| 'p': 50094,
000000a0 76 31 37 3a 6c 69 62 54 6f 72 72 65 6e 74 20 30 |v17:libTorrent 0| 'v': 'libTorrent 0.12.9' }
000000b0 2e 31 32 2e 39 65 |.12.9e |
000000b0 00 00 00 0c 05 | .....| - something (5) - checksum?