General discussion
Thread display: Collapse - |
All Comments
Start or search
Create a new discussion
If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.
Packet sniffing
I am karimkhan , I have a problem with JPCAP. I get all packets using JPCAP library. Also i have installed winpcap.
Everything seems to be fine. but when i try to print the header and data of a packet, i get to see some junk characters. Guess its a machine language.
Packet pack = captor.getPacket();
if (pack instanceof TCPPacket) {
TCPPacket tcpPacket = (TCPPacket) pack;
System.out.println(tcpPacket.dst_ip);
System.out.println(tcpPacket.dst_port);
byte[] data = tcpPacket.data;
String isoData = new String(data); //, "ISO-8859-1"
System.out.println("Packet :"+ isoData);
writer.writePacket(pack);
"
Output looks like
�8����WG�#uiz�^|�6��Y���]�pg��[!���o���GN_ٳ���H@�"qn��{ f��L������ȯ�d�.)������b껛�C�4��S�1�M�;V��Ih^���2��U�Z�y��7}���E��[�>}�vq��_�/��
M�Q���ؿQWȠ8E}q!D:��:�ǟ�T���n�����;�t뽆~hs�&�E�1�a*���;���������Spyu1C7�D[՚����w�/D{~v�D���{O���o|z�o�����frAC���L�zh������.�"qn��{ f��~h���t�B��92�XW�N|=���-�W 0����n�Ѻ@?L�Č6F�����у�_�?�
"
The header and data is some junk. Can you help me out? What is the reason for this? How do i get a meaningful header and data of the packet after identifying the packet as TCP, UDP or ICMP etc..