-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support models that expect a different IP and filename #3
Comments
I use Wireshark to investigate problems like this. It shows raw packets going over the Ethernet interface, so you can see if the device is simply not sending anything, if it expects a different address than the ones I tried my software with, etc. Now, there's usually tons of activity over the network, so you might want to plug in only your computer and the device in question to not see as much irrelevant stuff (you still might see some from your computer itself as it looks for other things on the network), or you might want to use a packet filter expression. If you know the MAC of the device (a 12-hexadigit number, usually written as six groups of two separated by colons or hyphens), you could filter based on that. It's usually physically written on a label on the device. The packet filter expression would look something like Otherwise, here are a few specific types of packets that are likely to be of interest:
If you can get a packet capture, I can probably help you interpret it. |
Hey there, thank you so much for trying to help me!
Then I tried to look for packets for specific ports or DHCP chatter, but came up empty on that front...
|
WHOOPS! :-) |
AND IT WORKS!!!!! :-)))) |
I'm glad you got it working. If you're able, could you get a packet capture of the successful procedure with the Hikvision tool? I'd like to see what it's doing so I can match it. fwiw, the "unexpected bytes" are these:
which looks like TFTP options as specified in RFC 2347 and RFC 2348, but in standard TFTP they'd be part of a request on the TFTP port. Here they're apparently on their own and sent to Hikvision's weird handshake port. |
Also, do those addresses |
Ah dang, I gave it back to him before I went to bed last night. |
No worries. I think now I misread that "unexpected bytes" line. I actually log that two places in my code, so it could have been either on the "handshake" socket or the TFTP socket, and the latter makes more sense. It looks like it's a valid request but for the filename I'll add a couple things to my TODO list:
Maybe we can see if my program works on this model with those changes. |
That sounds terrific! :-) In fact... |
Yeah, that'd be a lot slicker. I wonder if the official Hikvision TFTP server is doing something like that. One caveat is that I think raw packet interfaces are a lot less portable; right now the same code works on Linux, OS X, and (according to #1; I haven't tried it) Windows. Probably other systems too. For now, I just made the changes I described and mentioned them in the documentation. |
Nice! From observation I can tell that the original Hikvision server probably just picks up and uses whatever IP the active interface has and uses that for listening on. At least this is how it seems to work. (I tried several random IP-s just now under the VM). Also I agree.. that autodetect feature would be much less portable... And looks like Hikvision's design also simply leaves to the user to set up the networking (and the IP) as they see fit and adjusts to that. Still, portability aside, the issue of unknown initiator IP is a real problem as I experienced first hand. I wonder... How else could the procedure of finding an unknown device IP be made easier on a non tech-savvy end user, without damaging portability too much? Hm... Well, next week as I said, I'll be seeing that device again... can't wait to test! :-) |
fwiw, If I did recognize MACs (through any of the methods you mentioned: database of Hikvision OUIs, commandline flag, or interactively) and use raw packets, it wouldn't be too hard to skip the IP layer setup entirely. Listen for the ARPs on the raw socket and send a reply myself saying I have whatever IP they're looking for. Then listen for UDP packets on the raw socket and send a reply from whatever IP address they sent it to back to whatever IP address they mentioned they had. |
Another advantage of doing that would be that you could upgrade a bunch of devices at once, even ones that require different firmware. Through a config file or interactively, you could select what firmware to use for each MAC, and it'd work even if they're all using the same IP at once. |
Now THAT's just wicked! :-))) I'm not sure even Hikvision's tools can do this. |
It turns out that libpcap makes the raw packet stuff easy to do portably. There are two catches, though:
I don't think I have time to do anything like that right now. Maybe some day... |
Hey,
First of all, thank you for taking the time to develop this. I very, very much appreciate it... I was very relieved when I found it. :)
I'm trying to de-brick a hikvision DS-7608HI-ST/A for a friend. He tried to upgrade the thing, and... you know, the old story, he ended up installing the bad firmware version. Anyway...
I read on forums that it's possible to do this (upload a correct firmware file) via TFTP.
I use Fedora. I followed the - very simple - instructions given, also disabled my firewall to make sure all is working properly.
Current interface configuration:
So I connected the device to my LAN swtich (tried direct also!), powered the device on, and waited for something to happen...
Well, nothing really does happen. I started the python script like so:
... but nothing happens - it's just sitting there, even after many reboots, turnoffs, etc...
All I can see is that the RX/TX lights on my switch are blinking somewhat, there's definitely a correct link on the port... but nothing else.
I really don't mean to abuse your helpfulness, and I realize that this problem may or may not have to do anything at all with the tool you wrote - but could you give me a hint as to what may be wrong? Frankly, I'm at a loss here.
Thank you so much for any help you could give me.
Levente
The text was updated successfully, but these errors were encountered: