network={
ssid="EasyBox-123456"
scan_ssid=1
psk="ABCDEF01"
key_mgmt=WPA-PSK
}
network={
ssid="FRITZ!Box 7330 SL"
psk="75467325462321364920"
key_mgmt=WPA-PSK
priority=9148
disabled=1
}%presharedkey1=ABCDEF01
%presharedkey2=75467325462321364920psk="([^"]+)"psk="ABCDEF01"
and not only:
ABCDEF01
Test (36)
A1: Variable Set [
Name:%text
To:network={
ssid="EasyBox-123456"
scan_ssid=1
psk="ABCDEF01"
key_mgmt=WPA-PSK
}
network={
ssid="FRITZ!Box 7330 SL"
psk="75467325462321364920"
key_mgmt=WPA-PSK
priority=9148
disabled=1
}
Do Maths:Off
Append:Off ]
A2: Variable Search Replace [
Variable:%text
Search:(?<=psk=")[^"]+
Ignore Case:Off
Multi-Line:Off
One Match Only:Off
Store Matches In:%presharedkey
Replace Matches:Off
Replace With:$1 ]
A3: Flash [
Text:%presharedkey()
Long:Off ]
Change your regex to (?<=psk=")[^"]+ and remove Replace Matches:
....
WlanKeys (609)
A1: [X] Popup [ Title:Info Text:Gets from the wifi file:
/data/misc/wifi/wpa_supplicant.conf
all ssids (ssid) and keys (psk).
Compares in the for-loop each ssid from the list with the actual ssid if connected and shows a popup if found.
The actual psk will be copied to the clipboard.
If the acutal ssid is not in the list (e.g. not connected), the complete list (ssid;psk) of ssid and keys are copied to the clipboard. Background Image: Layout:Popup Timeout (Seconds):5 Show Over Keyguard:Off ]
A2: Flash [ Text:Please wait, while wifi keys are gathered... Long:On ]
A3: Variable Set [ Name:%wifipath To:/data/misc/wifi/wpa_supplicant.conf Do Maths:Off Append:Off ]
A4: Run Shell [ Command:su
cat %wifipath Timeout (Seconds):5 Use Root:On Store Output In:%wlan Store Errors In:%error Store Result In: Continue Task After Error:On ]
A5: If [ %error Set ]
A6: Popup [ Title:Error Text:%error Background Image: Layout:PopupFullSmallFont Timeout (Seconds):30 Show Over Keyguard:On ]
A7: Stop [ With Error:Off Task: ]
A8: End If
A9: Variable Search Replace [ Variable:%wlan Search:network=\{[^}]+\} Ignore Case:Off Multi-Line:On One Match Only:Off Store Matches In:%wlannetwork Replace Matches:Off Replace With:$1 ]
A10: Test Net [ Type:Wifi SSID Data: Store Result In:%ssidconnected Continue Task After Error:On ]
A11: Variable Set [ Name:%ssidconnected To:0 Do Maths:Off Append:Off ] If [ %ssidconnected !Set ]
A12: For [ Variable:%count Items:1:%wlannetwork(#) ]
A13: Variable Search Replace [ Variable:%wlannetwork(%count) Search:(?<=psk=")[^"]+ Ignore Case:Off Multi-Line:On One Match Only:Off Store Matches In:%wlanpsk Replace Matches:Off Replace With:$1 ]
A14: Variable Search Replace [ Variable:%wlannetwork(%count) Search:(?<=ssid=")[^"]+ Ignore Case:Off Multi-Line:On One Match Only:Off Store Matches In:%wlanssid Replace Matches:Off Replace With:$1 ]
A15: Variable Set [ Name:%wlanssidpsk To:(%wlanssid();%wlanpsk())
Do Maths:Off Append:On ]
A16: If [ %ssidconnected eq %wlanssid() ]
A17: Popup [ Title:WLAN Login Text:ssid: %wlanssid()
psk: %wlanpsk() copy to clipboard Background Image: Layout:Popup Timeout (Seconds):15 Show Over Keyguard:Off ]
A18: Set Clipboard [ Text:%wlanpsk() Add:Off ]
A19: Variable Set [ Name:%copyall To:no Do Maths:Off Append:Off ]
A20: End If
A21: End For
A22: Set Clipboard [ Text:%wlanssidpsk Add:Off ] If [ %copyall !Set ]
<TaskerData sr="" dvi="1" tv="4.8u5">
<Task sr="task609">
<cdate>1470851385619</cdate>
<edate>1470922585527</edate>
<id>609</id>
<nme>WlanKeys</nme>
<pri>100</pri>
<Action sr="act0" ve="7">
<code>550</code>
<on>false</on>
<Str sr="arg0" ve="3">Info</Str>
<Str sr="arg1" ve="3">Gets from the wifi file:
/data/misc/wifi/wpa_supplicant.conf
all ssids (ssid) and keys (psk).
Compares in the for-loop each ssid from the list with the actual ssid if connected and shows a popup if found.
The actual psk will be copied to the clipboard.
If the acutal ssid is not in the list (e.g. not connected), the complete list (ssid;psk) of ssid and keys are copied to the clipboard.</Str>
<Str sr="arg2" ve="3"/>
<Str sr="arg3" ve="3">Popup</Str>
<Int sr="arg4" val="5"/>
<Int sr="arg5" val="0"/>
</Action>
<Action sr="act1" ve="7">
<code>548</code>
<Str sr="arg0" ve="3">Please wait, while wifi keys are gathered...</Str>
<Int sr="arg1" val="1"/>
</Action>
<Action sr="act10" ve="7">
<code>547</code>
<Str sr="arg0" ve="3">%ssidconnected</Str>
<Str sr="arg1" ve="3">0</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%ssidconnected</lhs>
<op>13</op>
<rhs></rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act11" ve="7">
<code>39</code>
<Str sr="arg0" ve="3">%count</Str>
<Str sr="arg1" ve="3">1:%wlannetwork(#)</Str>
</Action>
<Action sr="act12" ve="7">
<code>598</code>
<Str sr="arg0" ve="3">%wlannetwork(%count)</Str>
<Str sr="arg1" ve="3">(?<=psk=")[^"]+</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="1"/>
<Int sr="arg4" val="0"/>
<Str sr="arg5" ve="3">%wlanpsk</Str>
<Int sr="arg6" val="0"/>
<Str sr="arg7" ve="3">$1</Str>
</Action>
<Action sr="act13" ve="7">
<code>598</code>
<Str sr="arg0" ve="3">%wlannetwork(%count)</Str>
<Str sr="arg1" ve="3">(?<=ssid=")[^"]+</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="1"/>
<Int sr="arg4" val="0"/>
<Str sr="arg5" ve="3">%wlanssid</Str>
<Int sr="arg6" val="0"/>
<Str sr="arg7" ve="3">$1</Str>
</Action>
<Action sr="act14" ve="7">
<code>547</code>
<Str sr="arg0" ve="3">%wlanssidpsk</Str>
<Str sr="arg1" ve="3">(%wlanssid();%wlanpsk())
</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="1"/>
</Action>
<Action sr="act15" ve="7">
<code>37</code>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%ssidconnected</lhs>
<op>0</op>
<rhs>%wlanssid()</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act16" ve="7">
<code>550</code>
<Str sr="arg0" ve="3">WLAN Login</Str>
<Str sr="arg1" ve="3">ssid: %wlanssid()
psk: %wlanpsk() copy to clipboard</Str>
<Str sr="arg2" ve="3"/>
<Str sr="arg3" ve="3">Popup</Str>
<Int sr="arg4" val="15"/>
<Int sr="arg5" val="0"/>
</Action>
<Action sr="act17" ve="7">
<code>105</code>
<Str sr="arg0" ve="3">%wlanpsk()</Str>
<Int sr="arg1" val="0"/>
</Action>
<Action sr="act18" ve="7">
<code>547</code>
<Str sr="arg0" ve="3">%copyall</Str>
<Str sr="arg1" ve="3">no</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
</Action>
<Action sr="act19" ve="7">
<code>38</code>
</Action>
<Action sr="act2" ve="7">
<code>547</code>
<Str sr="arg0" ve="3">%wifipath</Str>
<Str sr="arg1" ve="3">/data/misc/wifi/wpa_supplicant.conf</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
</Action>
<Action sr="act20" ve="7">
<code>40</code>
</Action>
<Action sr="act21" ve="7">
<code>105</code>
<Str sr="arg0" ve="3">%wlanssidpsk</Str>
<Int sr="arg1" val="0"/>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%copyall</lhs>
<op>13</op>
<rhs></rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act3" ve="7">
<code>123</code>
<se>false</se>
<Str sr="arg0" ve="3">su
cat %wifipath</Str>
<Int sr="arg1" val="5"/>
<Int sr="arg2" val="1"/>
<Str sr="arg3" ve="3">%wlan</Str>
<Str sr="arg4" ve="3">%error</Str>
<Str sr="arg5" ve="3"/>
</Action>
<Action sr="act4" ve="7">
<code>37</code>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%error</lhs>
<op>12</op>
<rhs></rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act5" ve="7">
<code>550</code>
<Str sr="arg0" ve="3">Error</Str>
<Str sr="arg1" ve="3">%error</Str>
<Str sr="arg2" ve="3"/>
<Str sr="arg3" ve="3">PopupFullSmallFont</Str>
<Int sr="arg4" val="30"/>
<Int sr="arg5" val="1"/>
</Action>
<Action sr="act6" ve="7">
<code>137</code>
<Int sr="arg0" val="0"/>
<Str sr="arg1" ve="3"/>
</Action>
<Action sr="act7" ve="7">
<code>38</code>
</Action>
<Action sr="act8" ve="7">
<code>598</code>
<Str sr="arg0" ve="3">%wlan</Str>
<Str sr="arg1" ve="3">network=\{[^}]+\}</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="1"/>
<Int sr="arg4" val="0"/>
<Str sr="arg5" ve="3">%wlannetwork</Str>
<Int sr="arg6" val="0"/>
<Str sr="arg7" ve="3">$1</Str>
</Action>
<Action sr="act9" ve="7">
<code>341</code>
<se>false</se>
<Int sr="arg0" val="5"/>
<Str sr="arg1" ve="3"/>
<Str sr="arg2" ve="3">%ssidconnected</Str>
</Action>
<Img sr="icn" ve="2">
<nme>hd_device_access_accounts</nme>
</Img>
</Task>
</TaskerData>
Hallo
I don't see the exact function how the Search Replace action works.
I have problems with the subtitiution and the capture group.
For: %num Items: 1:%presharedkey(#<)
Variable Search/Replace: %presharedkey(%num)
Search: <your search>
Replace Matches: On
Replace With: <your replacement>
End For
...
- if "Replace Matches" is checked, the whole Variable (Input) is concerned and only the Matches are replaced.E.g.Variable Set%input=This is a text with 123 numbers of manySearch ReplaceVariable=%inputSearch=(\d+) numbers ofReplace With:$1
will set %input to: This is a text with 123 many