Thursday, February 18, 2016

Page source fetch from WebView or UIWebView

On both Android and iOS, it is possible for an application to obtain page source from a browser view.

For Android,
http://lexandera.com/2009/01/extracting-html-from-a-webview/


For iOS,
http://stackoverflow.com/questions/5167254/getting-the-html-source-code-of-a-loaded-uiwebview

    NSString *yourHTMLSourceCodeString = [webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.outerHTML"];       

Question:  How to with WKWebView?

Monday, February 15, 2016

VMware Player add brigde

Typically, VMware uses VMnet0 as bridge device.  After installing the latest VMware player, there is no VMnet0 showing up.

Here is a procedure to create a VMware bridge on a physical device.

Right click on a network device and select property
Click Install
Select Service and Add...
Select VMware and install VMware Bridge Protocol.


Virtualbox guest Yosemite

VBoxManage.exe modifyvm Yosemite --cpuidset 00000001 000306a9 04100800 7fbae3ff bfebfbff
VBoxManage setextradata Yosemite "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "MacBookPro11,3"
VBoxManage setextradata Yosemite "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
VBoxManage setextradata Yosemite "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple"
VBoxManage setextradata Yosemite "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VBoxManage setextradata Yosemite "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1

Thursday, February 11, 2016

ebtables and iptables

These two commands are basic firewall configuration commands.

Show command help information
iptables -h
ebtables -h

Samples
1) block ip output traffic on port 4002
iptables -A OUTPUT -p ip --dport 4002 -j DROP

2) block ipv4 (udp) forwarding traffic on port 4002 and on mac ID 00:20:c0:01:7c:21
ebtables -A FORWARD -p IPv4 --src 00:20:c0:01:7c:21 --ip-protocol udp --ip-source-port 4002 -j DROP

More information
http://ebtables.netfilter.org/misc/ebtables-man.html
http://ebtables.netfilter.org/examples/basic.html
https://en.wikipedia.org/wiki/Iptables
https://upload.wikimedia.org/wikipedia/commons/3/37/Netfilter-packet-flow.svg