|
2014-02-03
, 20:48
|
|
Moderator |
Posts: 3,718 |
Thanked: 7,419 times |
Joined on Dec 2009
@ Bize Her Yer Trabzon
|
#2
|
|
2014-02-03
, 21:08
|
Posts: 151 |
Thanked: 158 times |
Joined on Apr 2012
@ UK
|
#3
|
|
2014-02-03
, 21:22
|
|
Posts: 38 |
Thanked: 19 times |
Joined on Jan 2012
@ 127.0.0.1
|
#4
|
Here you go: http://store.ovi.com/content/257443
QAD WLAN Password Recovery
TMO Thread: http://talk.maemo.org/showthread.php?t=82489
|
2014-02-03
, 21:46
|
Posts: 1,048 |
Thanked: 1,127 times |
Joined on Jan 2010
@ Amsterdam
|
#5
|
gconftool -R / > /home/user/MyDocs/output.txt
The Following 4 Users Say Thank You to anthonie For This Useful Post: | ||
|
2014-02-04
, 06:44
|
Posts: 986 |
Thanked: 1,526 times |
Joined on Jul 2010
|
#6
|
#!/usr/bin/perl use strict; use warnings; sub addWifiFromNet(); sub clearAllWifi(); sub getExisting(); sub getWifiGconf($$$); sub getGconfCmds($); sub gconfGetCmd($); sub gconfSetCmd($$$;$); sub listInt($); sub listString($); sub ssidListInt($); sub wpaPskListInt($$); sub randHex($); sub randomId(); sub runBT(@); my $usage = "Usage: $0 print all wifi networks on the phone "; my $rootDir = '/system/osso/connectivity/IAP'; my $noAutoFile = "$ENV{HOME}/Code/n9/wifi-noauto"; my $TRUE = ['true', 'bool']; my $FALSE = ['false', 'bool']; my $wifiAtts = { name => [""], wlan_ssid => listInt [], EAP_wpa_preshared_key => listInt [], EAP_wpa_preshared_passphrase => [""], http_check_status => ["no_login"], proxytype => ["NONE"], wlan_hidden => $FALSE, wlan_security => ["WPA_PSK"], type => ["WLAN_INFRA"], autoconnect => $TRUE, ipv4_type => ["AUTO"], }; my $gprsAtts = { name => [""], gprs_accesspointname => [""], sim_imsi => [""], gprs_username => [""], gprs_password => [""], type => ["GPRS"], autoconnect => $TRUE, ask_password => $FALSE, first_time_dialog_shown => $TRUE, ipv4_autodns => $TRUE, ipv4_type => ["AUTO"], }; sub main(@){ my $get = 1; # if(@_ == 1 and $_[0] =~ /^(-g)$/){ # $get = shift; # } die $usage if @_ > 0; if(defined $get){ my $networks = getExisting(); my $sortByName = sub{$$networks{$a}{name} cmp $$networks{$b}{name}}; for my $id(sort $sortByName keys %$networks){ if($$networks{$id}{type} eq "WLAN_INFRA"){ my $name = $$networks{$id}{name}; my $key = $$networks{$id}{EAP_wpa_preshared_passphrase} || ''; print "$name => $key\n"; } } }else{ #print "clearing all wifi networks\n"; #clearAllWifi(); #print "\n\n"; #print "adding wifi networks from net\n"; #addWifiFromNet(); } } sub addWifiFromNet(){ my @cmds; my %noAuto = map {chomp; $_ => 1} `cat $noAutoFile 2>/dev/null`; for my $ssidName(sort split /\n/, runBT "winfo", "--list-all"){ my $info = runBT "winfo", $ssidName; my $ssid = $1 if $info =~ /^ssid:(.*)$/m; my $enc = $1 if $info =~ /^enc:(.*)$/m; my $key = $1 if $info =~ /^key:(.*)$/m; my $mode = $1 if $info =~ /^mode:(.*)$/m; my $auto = $1 if $info =~ /^auto:(.*)$/m; my $autoConnect = $auto =~ /^\d+$/ ? 'true' : 'false'; if($enc =~ /WPA/i and $mode =~ /managed/i){ if(defined $noAuto{$ssid}){ print " forcibly disabling autoconnect for $ssid\n"; $autoConnect = 'false'; } my $wifiCmds = getGconfCmds(getWifiGconf $ssid, $key, $autoConnect); push @cmds, "echo adding: SSID='$ssid' WPA='$key' auto='$autoConnect'"; @cmds = (@cmds, @$wifiCmds); } } system "n9", "-s", join "\n", @cmds; } sub clearAllWifi(){ my $networks = getExisting(); my @cmds; for my $id(keys %$networks){ if($$networks{$id}{type} eq "WLAN_INFRA"){ my $name = $$networks{$id}{name}; $name = '' if not defined $name; push @cmds, "echo 'deleting $id => $name'"; push @cmds, "gconftool --recursive-unset $rootDir/$id"; } } system "n9", "-s", join "\n", @cmds if @cmds > 0; } sub getExisting(){ #my @iapLines = `n9 -u user -s gconftool -R $rootDir`; my @iapLines = `gconftool -R $rootDir`; my %allAtts = (%$wifiAtts, %$gprsAtts); my $id; my $networks = {}; my $h4Re = "[a-f0-9]{4}"; my $h8Re = "[a-f0-9]{8}"; my $h12Re = "[a-f0-9]{12}"; my $attRe = join "|", keys %allAtts; for my $line(@iapLines){ if($line =~ /^ $rootDir\/($h8Re-$h4Re-$h4Re-$h4Re-$h12Re):$/){ $id = $1; $$networks{$id} = {}; }elsif(defined $id and $line =~ /^ ($attRe) = (.*)$/){ $$networks{$id}{$1} = $2; } } return $networks; } sub getWifiGconf($$$){ my ($ssid, $wpa, $auto) = @_; my $id = randomId; my $dir = "$rootDir/$id"; my $gconf = {}; for my $att(keys %$wifiAtts){ $$gconf{"$dir/$att"} = $$wifiAtts{$att}; } $$gconf{"$dir/name"} = [$ssid]; $$gconf{"$dir/wlan_ssid"} = ssidListInt $ssid; $$gconf{"$dir/EAP_wpa_preshared_key"} = wpaPskListInt $ssid, $wpa; $$gconf{"$dir/EAP_wpa_preshared_passphrase"} = [$wpa]; $$gconf{"$dir/autoconnect"} = $auto =~ /true/i ? $TRUE : $FALSE; return $gconf; } sub getGconfCmds($){ my $gconf = shift; my $cmds = []; for my $key(keys %$gconf){ my @arr = @{$$gconf{$key}}; my $val = shift @arr; my $type = @arr > 0 ? shift @arr : 'string'; my $listType = @arr > 0 ? shift @arr : undef; push @$cmds, gconfSetCmd($key, $val, $type, $listType); } return $cmds; } sub gconfGetCmd($){ return "gconftool-2 --get $_[0]"; } sub gconfSetCmd($$$;$){ my ($key, $val, $type, $listType) = @_; my $cmd = "gconftool-2 --set '$key' '$val' --type=$type"; if(lc $type eq 'list'){ $cmd .= " --list-type=$listType"; } return $cmd; } sub listInt($){ my @list = @{shift()}; my $val = '[' . (join ',', @list) . ']'; return [$val, 'list', 'int']; } sub listString($){ my @list = @{shift()}; my $val = '[' . (join ',', @list) . ']'; return [$val, 'list', 'string']; } sub ssidListInt($){ my ($ssid) = @_; my @dec; for(my $i=0; $i<length $ssid; $i++){ push @dec, ord(substr $ssid, $i, 1); } return listInt(\@dec); } sub wpaPskListInt($$){ my ($ssid, $passphrase) = @_; my $net = runBT "wpa_passphrase", $ssid, $passphrase; if($net =~ /^\s*psk=([0-9a-f]+)\s*$/m){ my $psk = $1; my @bytes; for(my $i=0; $i<length $psk; $i+=2){ push @bytes, substr $psk, $i, 2; } my @dec = map {sprintf("%d", hex($_))} @bytes; return listInt(\@dec); } return undef; } sub randHex($){ my $digs = shift; return lc sprintf "%0${digs}X", rand(16**$digs); } sub randomId(){ return join '-', randHex(8), randHex(4), randHex(4), randHex(4), randHex(12); } sub runBT(@){ open FH, "-|", @_; my @lines = <FH>; close FH; return join '', @lines; } &main(@ARGV);
One thing that I want to do is duplicating my Wi-Fi connections. SSID isn't a problem, but there are several hidden (WPA Pre-Shared) Keys that I forgot. Is there a way to show these or are they lost forever?
Man is virus.
I ♥ my N9 16GB Black.
(059J201 RM-696 NDT BENELUX BLACK 16GB)