12-09-2013 02:44 PM
Hi guys,
I know here is not a shell/bash programming community, but I need a urgent help. At my customer's site there are some location that haven't any DHCP server, neither any windows machine for changing default IP addresses of cams but ony Media Server running and up with correct IP interfaces. I have prepared a shell script that use wget command to login the default IP address camera and get the sessionID from that and use it to change the IP address to the correct one. My problem is that when I have tested the script to HTTP enable cams it works prefect. But when I run it to the default config cams it fails to get the sessionID from cameras. Any ideas?
Here is my changeCamIP-HTTPs.sh script file;
#=================================
wget -d -U"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)" --no-check-certificate --server-response --post-data="version=1.0&action=login&userName=admin&password=admin" --no-check-certificate --restrict-file-names=nocontrol -O $1 https://$1/login.cs
pidof wget > wait
sessionID=$(cat $1 | grep \"sessionID\" | cut -d'=' -f4 | cut -d'"' -f2)
echo $sessionID
wget -U"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)" --no-check-certificate --restrict-file-names=nocontrol -O ret https://$1/ipaddressing.cs?version=1.0\&sessionID=$sessionID\&action=set\&ipVersion=1\&addressingType=2\&ipAddress=$2\&subnetMask=255.255.255.0\&defaultGatewayIPAddress=$3\&primaryDNSIPAddress=\&secondaryDNSIPAddress=
rm -fr $1
rm -fr ret
echo "OK"
#=================================
I am running the script with these parameters: #./changeCamIP-HTTPs.sh 192.168.0.100 New_IP New_GW
Only 3 option is enough.
When I changed the https to http it works perfectly. But default cams doesnt support HTTP..
Thanks for any help and ideas.
Solved! Go to Solution.
12-10-2013 05:59 AM
I'm willing to take a crack at this with you, if it's still an issue.
Chances are, the default / NIB (New-In-Box) cameras are presenting with an initialization screen where you set up an account initially? I don't have the cycles to figure that part out with you, but that's what came to mind.
So what else *do* you actually have at the site? Your own workstation? Media Server only?
Why not just spin up a temporary DHCP daemon on the Media Server with a tiny scope to grab your cameras temporarily so that you can get under management within VSOM and switch them to static that way? (Don't forget to decommision the DHCP daemon after this ;-)
Best of luck!
P.S. - I have a feeling I'm *realllllly* missing something here after thinking it over for a while... You state you don't have any Windows boxes on the site? How.... would the client actually use... VSM in this case?
12-10-2013 05:59 AM
I'm willing to take a crack at this with you, if it's still an issue.
Chances are, the default / NIB (New-In-Box) cameras are presenting with an initialization screen where you set up an account initially? I don't have the cycles to figure that part out with you, but that's what came to mind.
So what else *do* you actually have at the site? Your own workstation? Media Server only?
Why not just spin up a temporary DHCP daemon on the Media Server with a tiny scope to grab your cameras temporarily so that you can get under management within VSOM and switch them to static that way? (Don't forget to decommision the DHCP daemon after this ;-)
Best of luck!
P.S. - I have a feeling I'm *realllllly* missing something here after thinking it over for a while... You state you don't have any Windows boxes on the site? How.... would the client actually use... VSM in this case?
12-10-2013 01:21 PM
Hİ Scott,
Yes there aren't any windows machines. But you're right we may install and dhcpd rpm on MS if available for redhat el 5.8 version. Today, we have also decided to do this with my colleague..
Thanks for reply.
12-10-2013 04:09 PM
Thanks to Call Manager setup iso (which ise rhel5.8) that I have extracted dhcp rpm and install on MS. Then it works perfectly.
P.S: As Scott said that I havent start the dhcpd script automaticaly by putting link to rc3.d SXX.dhcpd etc etc. Just running /etc/init.d/dhcpd start and after setting the cameras IP address to static one then I will stop it.
12-11-2013 05:18 AM
Awesome! Where there's a will, there's a way!
Have a good day!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide