Related
Little utility for waking up / shutting down / rebooting or Logging off from the PC's on your network via you wm device.
Requirements;
# Wifi active on wm and connected on same local network as PC's
# Wake-On-Lan enabled on PC's
# allow http traffic on Port 7777
# obtain MAC Address for all PC's you wish to 'control'
# Multi form factor - check CAB name for correct version for your device
1. Install cab on device
2. Install the service via the msi installer on any PC's you wish to 'control'
3. Edit the WakeAndShakeConfig.xml on the device OR use the settings screen from within the app - enter your PC's IP addresses (or host name) and their corresponding MAC addresses.
09/02/2010 - Settings screen added (still needs some tweaking, a few navigation bugs)
Any Q's shout.
If you find this useful & wish to donate please see my sig button.
-=-=-
20/03 - update service installer
VGA Version?
Is there any chance for VGA version?
various form factors added, see #1
cheers,
dan
man I've been dying for something like this for a while... eagerly awaiting a QVGA version
Wish someone can make a Video Tutorial
on how to set this & post on youtube
Please
pndragon said:
man I've been dying for something like this for a while... eagerly awaiting a QVGA version
Click to expand...
Click to collapse
will try and do one later today ;-)
Thanks for sharing
added QVGA cab - see post #1
updated the PC service - if user cancels shutdown subsequent shutdown requests will now be triggered
Hi dt_matthews,
it will be very amazing was it possible to skin it for DUSK.
I have seen the screenshot and i was thinking is this something what be possible in a future version?
added IP address to settings xml and config, this is required if your PPC doesnt have regsitry entries mimicking hosts file lookup, ip address will be shown in the machine drop-down list along with the machine name
added IP address to xml and to settings screen - this is required for PPC's that dont have registry entries which mimic hosts file lookups, these IP's are displayed in the machine dropdown along with the machine name
Been waiting for an app like this
To bad I can't get the settings screen to work, it won't save the data I type in to the host, ip and mac fields.
And the xml file is clean except from the settings tag so I don't know how to modify the parameters
Please help...
HTML:
<settings><machine name="machineName1" mac="071EB93CAD68" ip="192.168.1.87"/><machine name="machineName2" mac="0219DDAFC6B3" ip="192.168.1.85"/><machine name="machineName3" mac="001A437AA515" ip="192.168.1.65"/></settings>
This is a sample of a valid version of the xnml config. Just obviously change the name tags, the mac and the IP addresses to match your machines. then run the service installer on your machines and the cab on your device and you should be fine.
shout if its not clear
cheers,
dan
Thanx! Works a lot better when one knows the param names
Next problem
Can't get the HTTP Shutdown to run properly on the PC. It starts automatic but then stopps as it has no work to do (according to windows)
Suggestions?
240z said:
Thanx! Works a lot better when one knows the param names
Next problem
Can't get the HTTP Shutdown to run properly on the PC. It starts automatic but then stopps as it has no work to do (according to windows)
Suggestions?
Click to expand...
Click to collapse
that is as designed, its an http listener which wont be show as actively 'doing' anything by svchost.exe [service manager]. as long as you are connected to the same network (and workgroup) it should be ok. let me know
i've tried this on two machines now. on one of them it won't work at all. on the other i got it to reboot ones. but know it doesn't work anymore.
on both machines windows reports application error on shutdownpcservice.exe and wants to send an error report to microsoft.
in the application log (under computer managment) i used to see how the shutdownservice started to listen to port 7777, but not anymore. it's like it not running.
i've tried to reinstall the program but that didn't do it.
thanks for your effort Dan
240z said:
i've tried this on two machines now. on one of them it won't work at all. on the other i got it to reboot ones. but know it doesn't work anymore.
on both machines windows reports application error on shutdownpcservice.exe and wants to send an error report to microsoft.
in the application log (under computer managment) i used to see how the shutdownservice started to listen to port 7777, but not anymore. it's like it not running.
i've tried to reinstall the program but that didn't do it.
thanks for your effort Dan
Click to expand...
Click to collapse
hey dude,
i've updated the service installer (see post #1) - uninstall the last version (make sure the service is uninstalled fully, you may need to uninstall it from the cmd line if it wont uninstall via the GUI) then install the new version, that is the version i am running without problems, let me know how you get on, happy to help with any tweaking ;-)
Can this be used to put the PC to sleep (into standby) rather than shutdown? If not, could this feature be added?
Windows cmd line doesnt support sleep, but there is an alternative i could use (i think), but i cant do it straight away since my pc with the code on has just given up the ghost and it'll be a bit of time till i can get the data off it, but let me know if you can wait and i'll do it as soona s i can.
cheers,
dan
Hey guys,
There has been a lot of great strides here in learning more about this WP7 and what it's capabilities are! I'm very excited about what everyone is doing!
I'm sure a lot of you have been doing your own tinkering and was hoping to combine some efforts and maybe eventually come up with a solid SDK for home brew applications.
Here is where I'm at with my exploration:
With the COM bridge and Visual Studio 2008 one can develop a native ARM COM DLL to talk to native code from Silverlight.
I believe the ComBridge.RegisterComDll does not really register the COM class in the system registry. I believe the runtime simply caches the clsid and filename and creates the class when the runtime is looking to instantiate the ComImport COM class.
We are able to use wince's win32 API to make operating system calls from the C++ code.
There does not seem to be any security restrictions that I have come across in using the operating system from native code. I will note that without the NETWORKING caps in the manifest, DNS would only resolve cached addresses, but the rest of the sockets worked fine. I do not believe this to be a security measure, but more of a missing initialization method I am not aware of.
We can return other COM interfaces created in our native code and talk to it by implementing the COM interop interfaces in C# ( InterfaceType(ComInterfaceType.InterfaceIsIUnknown))
Currently I have written a sockets library here: dl[dot]dropbox[dot][c][o][m]/u/4165054/PhoneNetworkingSample[dot]zip
I also have the workings of a file system library that I have not completed yet. I realize there is some OEM lib out there that does FS access, but I believe it to be important to homebrew that we make our own.
I recently have been looking into Direct3D 11 API support for the phone. I have successfully created a D3D11 device and passed it back to .NET code where I was able to execute some methods on it. A lot of work needs to be done here. First the device is almost useless if we cannot render to something. I believe I have been able to create a window, but not been able to actually show it. My next method of attack will be to find the hwnd Silverlight is rendering to, hook its WndProc and do our own rendering here.
If anyone else has any information on their hacking, please let us know! You can contact me on this board or on twitter [at-sign]jmorrill.
-Jer
Great work! I will definitely have a look at the sockets source code. This should open up a lot of possibilities for app developers
Sent from my HTC HD2 using XDA App
jmorrill said:
Hey guys,
[*]We are able to use wince's win32 API to make operating system calls from the C++ code.
[*]There does not seem to be any security restrictions that I have come across in using the operating system from native code. I will note that without the NETWORKING caps in the manifest, DNS would only resolve cached addresses, but the rest of the sockets worked fine. I do not believe this to be a security measure, but more of a missing initialization method I am not aware of.
[/LIST]
Click to expand...
Click to collapse
There definitely are security restrictions applied to the native code. This is what I think. Our applications are deployed in the Least Privilidged chamber (LPC) which has dynamic capabilities by the ones we specify when the application is deployed.
<Macro Id="LEAST_PRIVILEGE_CHAMBER_GROUP_NAME" Description="Least Privilege Chamber Group" Value="S-1-5-112-0-0X80" />
and are members of the:
<Account Id="S-1-5-112-0-0X70" Description="All public capability accounts are members of this group" FriendlyName="Public capabilities group" Type="Group" />
There are certain win32 API calls which are allowed but anything which could be used to compromise the OS is only allowed to be called from the TCB chamber.
<Macro Id="SYSTEM_CHAMBER_GROUP_NAME" Description="TCB Chamber Group" Value="S-1-5-112-0-0X00" />
<Macro Id="SYSTEM_USER_NAME" Description="TCB user SID" Value="S-1-5-112-0-0-1" />
For example, loading nativeinstallerhost.exe:
<Rule PriorityCategoryId="PRIORITY_HIGH" ResourceIri="/LOADERVERIFIER/ACCOUNT/(+)/ACCOUNT_CAN_LAUNCH/NONE/NONE/PRIMARY/WINDOWS/NATIVEINSTALLERHOST.EXE" SpeakerAcc ountId="S-1-5-112-0-0-1" Description="Only TCB can launch into this chamber">
I am guessing the LOADVERIFIER is doing this using the code signing certificates. If you check your apps they will be signed with a LPC certificate but if you look ones included in the ROM then they have TCB signing.
I can't see anything that would prevent you from doing socket stuff in the security policy (as you have found). However, it looks like you need:
<Macro Id="ELEVATED_RIGHTS_RESOURCE_GROUP_NAME" Description="Elevated Rights Resource Group SID" Value="S-1-5-112-0-0X14" />
To use raw sockets:
<Rule PriorityCategoryId="PRIORITY_STANDARD" ResourceIri="/RESOURCES/GLOBAL/WINSOCK/RAWSOCKET" SpeakerAccountId="S-1-5-112-0-0-1" Description="Acess to Winsock Ra w sockets">
<Authorize>
<!-- Match loaded from:
<Match AccountId="S-1-5-112-0-0X14" AuthorizationIds="GENERIC_ALL" />
</Authorize>
Would be useful to confirm that this is the case and that this policy is actually being applied
Yep, that reflects the same behavior in Windows on the desktop. Normal socket use is okay, raw requires admin.
Do we have a tutorial on how to create native COM classes?
Also, this url explains why you cannot copy/read some files from the \Windows directory, but can LoadLibrary on them (which is how I load d3d11.dll).
blogs.msdn.com/b/windowsmobile/archive/2007/12/29/why-can-t-i-copy-programs-out-of-windows.aspx
Sorry no tutorial on making COM objects. But basically just create a new smart device mfc dll in VS2008, then add a new ATL class to the project. I modified the COM interface/classes to inherit from IUnknown vs. IDispatch.
I guess I misspoke about the security restrictions. Really what I'm looking for, is to have about the same level of access to the device as any Windows Mobile application has, which is enough to suite most of my needs personally.
Ok, I've just created a native dll and call it from Silverlight.
Once you know what type of project to create it's quite easy. The longest part was to reinstall Visual Studio 2008.
Quick question: how do you handle passing string between native and managed? I have several ways in mid but they all seems very complicated.
(nico) said:
Ok, I've just created a native dll and call it from Silverlight.
Once you know what type of project to create it's quite easy. The longest part was to reinstall Visual Studio 2008.
Quick question: how do you handle passing string between native and managed? I have several ways in mid but they all seems very complicated.
Click to expand...
Click to collapse
Depends. Sometimes you can get away with StringBuilder. Or you can do a string outgument, and create the wchar_t in native code.
What I've done so far is creating wchar_t in native code, return an IntPtr to managed code, use Microsoft.Phone.InteropServices.Marshal.PtrToStringUni to get a string and then call a custom native method to delete my wchar_t array (didn't find a release method).
Seems a lot of work just to get a string...
(nico) said:
What I've done so far is creating wchar_t in native code, return an IntPtr to managed code, use Microsoft.Phone.InteropServices.Marshal.PtrToStringUni to get a string and then call a custom native method to delete my wchar_t array (didn't find a release method).
Seems a lot of work just to get a string...
Click to expand...
Click to collapse
Just stick it in a function, and be done with it. That way you only have to do it once. Don't worry about efficiency; unless it is in a tight loop, the string conversion isn't going to slow you down noticeably.
BTW, I got registry working and started working on a registry viewer.
However, I got access denied when trying to browser most of the node.
For example I can browse HKLM\System\State but not HKLM\System.
(nico) said:
What I've done so far is creating wchar_t in native code, return an IntPtr to managed code, use Microsoft.Phone.InteropServices.Marshal.PtrToStringUni to get a string and then call a custom native method to delete my wchar_t array (didn't find a release method).
Seems a lot of work just to get a string...
Click to expand...
Click to collapse
That isn't necessary at all. Simply define your managed class/interface with the MarshalAs attribute on your params. .NET will take care of the rest.
For example:
HRESULT MyFunction([in] LPWSTR param)
Would translate to:
UInt32 MyFunction(
[MarshalAs(UnmanagedType.LPWStr)]
[In] String param);
Thanks Rafael.
This is nice! How do I do the opposite? I need to create a string in unmanaged and use it from managed code Do I just have to use [out] instead of [in] in your example?
This is much simpler that my method
(nico) said:
Thanks Rafael.
This is nice! How do I do the opposite? I need to create a string in unmanaged and use it from managed code Do I just have to use [out] instead of [in] in your example?
Click to expand...
Click to collapse
Yep, it should match the direction indicated in your COM library's IDL. It basically just drives how Marshaller handles copying of memory, pinning, etc.
You guys are smarter the me at this, obviously, but is there a site where you share your code? because i'm smart enough to use existing code and make something happen..
jmorrill said:
I recently have been looking into Direct3D 11 API support for the phone. I have successfully created a D3D11 device and passed it back to .NET code where I was able to execute some methods on it. A lot of work needs to be done here. First the device is almost useless if we cannot render to something. I believe I have been able to create a window, but not been able to actually show it. My next method of attack will be to find the hwnd Silverlight is rendering to, hook its WndProc and do our own rendering here.
Click to expand...
Click to collapse
Have you checked out ZuneBoards? They've done some work in this area already with their OpenZDK, which looks similar to what we may need to do. Their method of breaking out of the CLI virtual machine is different than ours, but a lot of what they've done is what we want to do, too.
One thing that doesn't work are the typical WinCE graphics functions:
GetDC(NULL) ;
GetDesktopWindow();
LineTo();
GetClientRect();
That is they work, but the root window is empty! 0 wide and 0 tall. The drawing engine (unsurprisingly) is elsewhere.
ajhvdb said:
You guys are smarter the me at this, obviously, but is there a site where you share your code? because i'm smart enough to use existing code and make something happen..
Click to expand...
Click to collapse
Have you gotten anything to compile yet?
Check this one out: http://dl.dropbox.com/u/4165054/PhoneNetworkingSample.zip
And see if you can get it to compile (I would make it an attachment in this post but it's jmmorril's code). I've been using Visual Studio 2008 and the WinCE 6 refresh to compile the com dll: http://www.microsoft.com/downloads/...3A-A651-4745-88EF-3D48091A390B&displaylang=en
Then I copy the com dll over to my visual studio 2010 Windows Phone project, ready to be used. There are probably better ways, but you need to find out at least some way of doing it.
I've managed to create a basic Registry Viewer, readonly for the moment.
For now, I didn't manage to get access to root path, so the first 2 levels are hardcoded.
Download it here: (link removed, see below)
Edit:
Updated version here: http://bit.ly/eEZ0Uf
(nico) said:
I've managed to create a basic Registry Viewer, readonly for the moment.
For now, I didn't manage to get access to root path, so the first 2 levels are hardcoded.
Download it here: http://bit.ly/hOWLnI
Click to expand...
Click to collapse
wow man nice work , could you also make a file explorer ?
edit: here is a direct link http://www.xda-developers.ch/download/?a=d&i=7061084002
I know and testes PhoneNetworkingSample and it works, but only in TCP.
If there's a UDP support?
Support? Yes in a way. Jeremiah's sample is a thin layer around the very low level winsock and just because the datagram type isn't supported in Silverlight doesn't mean it won't be here.
I haven't tested this because there is a lot more work but if you look at line 42 of NetSockets.cpp in the Network native library project and change SOCK_STREAM to SOCK_DGRAM you'll have a good starting point. UDP is a connection-less socket but it seems to function in a very similar way to the point that the SendBytes and ReadBytes functions should just work for UDP. You'd just want to build a managed wrapper in the NetworkApi section to match what you're doing in the native code.
I'm personally not too clear on how to get the network c++ library to compile correctly but building the managed wrapper around it should be cake. Hope that helps.
Thanks for your response, only one more question:
Where can I download the "Network native library" source code to take a look. I Binged and Googled (in this order), and don't found it.
Thanks for your time!
duefectu said:
I know and testes PhoneNetworkingSample and it works, but only in TCP.
If there's a UDP support?
Click to expand...
Click to collapse
It is worth noting that the decidedly best way to access sockets is to use reflection to access the classes/methods for the System.Net namespace in the GAC.
duefectu said:
Thanks for your response, only one more question:
Where can I download the "Network native library" source code to take a look. I Binged and Googled (in this order), and don't found it.
Thanks for your time!
Click to expand...
Click to collapse
I fount it in the VS2008 folder
WP7 supports sockets?
Since when does WP7 supports sockets at all? Did I miss something?
zbend said:
Since when does WP7 supports sockets at all? Did I miss something?
Click to expand...
Click to collapse
You miss this -> http://forum.xda-developers.com/showthread.php?t=861501
Not for MarketPlace, but take a look to the new WP7 update, Microsoft plans to open the Homebrew access -> http://www.chevronwp7.com/
*REQUIRES ROOT*
Warning: Follow these directions at your own risk! I take no responsibility for any damage to your phone, personal information, dog, cat, or grandmother that may result from you voluntarily following these directions. If you blame me, I will laugh at you.
This information is partially from: http://forum.xda-developers.com/showthread.php?t=760472
This is my first topic post, so please let me know if you find it helpful!
I could not find a tutorial on getting Orbot transparent proxying to work on my SPH-D710, so this is how I got it working. I hope this is not a repost, but as I said I could not find a specific tutorial/howto.
It seems to me that the issue with Orbot on our phones has to do with the iptables that is included with Orbot. Even if you tell Orbot to use the default iptables (/system/bin/iptables), it still does not work.
(1) Install "Droidwall" and "Orbot" from the Android market.
(2) Open Droidwall so that it installs the necessary binaries.
(3) Do the following in adb or the terminal: (I prefer using adb)
Code:
[B]# cd /data/data/[/B]
[B]# find ./ -iname "*iptables*"[/B]
./com.mgranja.iptables
./org.torproject.android/app_bin/iptables
./com.googlecode.droidwall.free/app_bin/iptables_armv5
[B]# cp ./com.googlecode.droidwall.free/app_bin/iptables_armv5 ./org.torproject.android/app_bin/[/B]
[B]# cd /data/data/org.torproject.android/app_bin/[/B]
[B]# mv ./iptables ./iptables.ORIGINAL[/B]
[B]# mv ./iptables_armv5 ./iptables[/B]
(4) Open Orbot and go to (menu) -> Settings. Make sure to enable "Request Root Access," "Transparent Proxying" and "Tor Everything."
(5) On the bottom of the settings page, ensure that "Use Default Iptables" is NOT selected!
(6) Open Orbot, long press the 'power' button to start Tor. In the menu there is an option to make sure ("check") that you are connected through the Tor network.
Enjoy!
Sent from my SPH-D710 using Tapatalk
IPTABLES is your firewall.
So I wouldn't mess with them unless you know what you are doing.
You sound like you don't know what your doing if you have to "download" it.
kthejoker20 said:
IPTABLES is your firewall.
So I wouldn't mess with them unless you know what you are doing.
You sound like you don't know what your doing if you have to "download" it.
Click to expand...
Click to collapse
I agree that you shouldn't mess with it unless you know what you're doing. The app mentioned simply updates the version in /system/bin that came with your ROM -- whether or not you want to do this is up to you. (I just edited and removed the portion you made reference to.)
Regardless, in order to get Orbot working on the phone with transparent proxying, the main thing is to tell Orbot to use the default iptables in the ROM rather than the one Orbot comes with (/data/data/org.torproject.android/app_bin/iptables).
EDIT: With the edits made to my original post, this is now irrelevant.
I use to do this back in the day. At times it's handy however, the speeds are insanely slow so I stopped using it and just dealt with the fact that the carrier would see my every move on the network. They can do that regardless of the fact that you're using a proxy anyway so it just seemed like a waste. Slow speeds + they can still track me or fast speeds + they can still track me. Using Tor on a phone only prevents the site you're visiting from knowing who and where you are - not the carrier.
Just wanted to make that clear for anyone that doesn't know.
The speed is definitely a pain, but if you are willing to sacrifice some anonymity (probably a lot) you can configure Tor to only use nodes within your country - which I tested and got much faster speeds.
While your carrier can track that you are using their network, they cannot see what specifically you are doing. Tor encrypts all traffic from your phone -> entrance node -> intermediary nodes -> exit node (and vice versa). The only unencrypted leg of the journey is between the exit node and the destination host.
If anyone wants to read more https://www.torproject.org/about/overview.html.en
Sent from my SPH-D710 using Tapatalk
working
This worked for me, thank you so much. im runing a modded stock rom on my Lg Optimus black and it hasnt iptables, now everithing is fully working, thanks! now i can use facebook from mi phone on my work "restricted" network hehe
tor
You can also run tor from the terminal and from /data/data/*. It's much easier and you can delete all the iptables and orbot stuff. The default datadir for tor isn't working so I started tor with -datadir. For example tor -datadir /mnt/sdcard/tor.
Thank you I have been trying to get this running on my phone for a second.
Phpdna said:
You can also run tor from the terminal and from /data/data/*. It's much easier and I have deleted all the iptables and orbot stuff. Because the default datadir for tor isn't working on my device I started tor with -datadir. For example tor -datadir /mnt/sdcard/tor.
Click to expand...
Click to collapse
What are you doing exactly?
Can You explain more?
santasolo said:
What are you doing exactly?
Can You explain more?
Click to expand...
Click to collapse
I was trying to run tor without orbot. Orbot is too heavy for my mobile. I find tor is an app in /data and we can start it from the terminal with the datadir switch. I guess Orbot works, too, but I'm not so sure.
Very interesting post. Thanks for the info.
DankVader said:
Very interesting post. Thanks for the info.
Click to expand...
Click to collapse
If my answer is helpful please consider to thank me. Thank you!
I thought I did. But I must have forgotten to. Correcting that now. :victory:
I'm trying to make a module that replaces methods, modify variables that are passed as parameters, and call methods relatively to the hooked class (this.privateMethod()). But the offial wiki doesn't show how to either replace methods or use parameters.
Now some questions that I have are:
How can I create/modify instances of Objects that exists only in the hooked app? For example if a CustomClass object is passed as a parameter of a method I have hooked, how can I modify variables and call methods in the variable? And how can I create a new instance?
What should I return in a method I hooked with XC_MethodReplacement? It is registered as an Object so I should return something, but the method I'm hooking is a void.
How can I call private methods of a class I have an instance hooked of? Normally I'd call them with this.method(), but I don't think I have access to this "this" variable. Do I?
That's all I can think of from the top of my head, but more are bound to come up along the way. So if you have a reliable source of information like a guide, tutorial or blog post, please tell me!
Baconator724 said:
I'm trying to make a module that replaces methods, modify variables that are passed as parameters, and call methods relatively to the hooked class (this.privateMethod()). But the offial wiki doesn't show how to either replace methods or use parameters.
Now some questions that I have are:
Click to expand...
Click to collapse
http://api.xposed.info/
How can I create/modify instances of Objects that exists only in the hooked app? For example if a CustomClass object is passed as a parameter of a method I have hooked, how can I modify variables and call methods in the variable? And how can I create a new instance?
Click to expand...
Click to collapse
Simply use methods from XposedHelpers class. E.g. you can modify any field of CustomClass instance using appropriate setIntField, setObjectField, ... (depedning on type of variable you need to modify). For calling methods use XposedHelpers.callMethod() or callStaticMethod() in case of static methods.
To create new instance, get one of the defined constructors and call newInstance() (check with Java reflection docs).
What should I return in a method I hooked with XC_MethodReplacement? It is registered as an Object so I should return something, but the method I'm hooking is a void.
Click to expand...
Click to collapse
Simply return null
How can I call private methods of a class I have an instance hooked of? Normally I'd call them with this.method(), but I don't think I have access to this "this" variable. Do I?
Click to expand...
Click to collapse
XposedHelpers.callMethod(object, "methodName", params...)
where object is instance of class method belongs to. If you are within a hook, simply use params.thisObject as object.
Thanks! But could you explain this a bit more detailed?
C3C076 said:
To create new instance, get one of the defined constructors and call newInstance() (check with Java reflection docs).
Click to expand...
Click to collapse
Do I need to import the target APK in my project for this to work?
Baconator724 said:
Thanks! But could you explain this a bit more detailed?
Do I need to import the target APK in my project for this to work?
Click to expand...
Click to collapse
No. Use XposedHelpers.findConstructorExact() to get one of the constructors of class you want to instantiate and call newInstance() on that constructor supplying constructor parameters (if any).
Example : https://github.com/GravityBox/Gravi...low/gravitybox/quicksettings/QsTile.java#L123