Pages

Showing posts with label client. Show all posts
Showing posts with label client. Show all posts

Friday, June 1, 2012

Yet another XMPP Client for Android

First of all, git it from github: https://github.com/Buggaboo/android_xmpp_client

The features

  • GreenDao, database access. Say goodbye to e.g. SQL injection exploits, crap manual data type conversions;
  • Smack library (xmpp), modified for Android, with bugs, but not crashworthy;
  • It vibrates messages to morse code; (3 june 2012: WIP)
  • The messages can be translatable to different languages, just by leveraging the xml resources;
  • Multiple provider support, i.e. connect with google, microsoft, meebo, whatever you want;
  • Licence: GPLv3;
  • Support for android api levels 10 thru 15 (from gingerbread to ice cream sandwich due to compatibility library, 80% of the android  market);
  • Support for android api level 15 (pure ice cream sandwich, less than 10%);
  • Support for fragments (12 june 2012: WIP);
  • Support for android Notifications;


 

 

  The general design

  • Sharing data between Contexts via the database: A context alpha (e.g. Activity or Service) pokes another context beta with an Intent with a Bundle payload containing the record id of a certain database table.
  • To prevent competition for the same database resource, certain services take randomized naps, aka Thread.sleep(Long);
  • A message entity has a buddy entity has a connection entity, i.e. I use foreign keys, to sort and group data etc., GreenDao generates all the code you need;
  • BroadcastReceivers and ArrayAdapters work together to refresh your ListViews.

Known Issues

  1.  There are no bounds on how much data is pulled from the database and rendered as a view, the ListViews are potential memory hogs;
  2. There are no arbitrary limits on data input, which could eat all your memory;
  3. I have not stress-tested how many connections can be kept alive at the same time, before thread-related issues arise;
  4. I suspect that the smack library has its own issues with regard to Presence;
  5. I have not checked  for memory leakages, I use nested classes for my BroadcastReceivers, I haven't checked for cyclical references, I don't understand fully how garbage collection on android works;
  6. The vibrator notification can get annoying, or fun, depending on your mood.

Tuesday, July 20, 2010

Pstools part 2: preparing a client

After discovering pstools, I wanted to write a batch file to make clients more compliant to pstools. I got the grand idea of putting the batch file in the netlogon script of all the users; so all the clients would magically get compliant once a user logs on that specific machine. But alas, this plan fails, because you need system rights or admin rights to run the commands e.g. reg.exe and net.exe, to bore a hole in the local firewall (also, the group policies must be setup accordingly so that admin users have these rights).

To make a computer compliant you have to either image/ghost over the to-be compliant machine with an already compliant image or run this batch file and pray that it works. Or login with a superuser account on the target client machine and run this from netlogon (netlogon is to expedite things, but this is not compulsory), as I described earlier.

This command also works on most windows (professional edition) clients:
runas /user:administrator script.bat

or

runas /user:administrator@your-ad-network.tld script.bat


@echo off
REM Make pstools and rdp work on all client machines and add local superuser
echo "-- Make client compliant for pstools --"
REM pstools - make compliant from registry
reg add "hklm\system\currentcontrolset\control" /f /v SCMApiConnectionParam /t REG_DWORD /d 1
reg add "hkcu\software\sysinternals\loggedon" /f /v EulaAccepted /t REG_DWORD /d 1
reg add "hkcu\software\sysinternals\psexec" /f /v EulaAccepted /t REG_DWORD /d 1
reg add "hkcu\software\sysinternals\psfile" /f /v EulaAccepted /t REG_DWORD /d 1
reg add "hkcu\software\sysinternals\psgetsid" /f /v EulaAccepted /t REG_DWORD /d 1
reg add "hkcu\software\sysinternals\psinfo" /f /v EulaAccepted /t REG_DWORD /d 1
reg add "hkcu\software\sysinternals\pskill" /f /v EulaAccepted /t REG_DWORD /d 1
reg add "hkcu\software\sysinternals\pslist" /f /v EulaAccepted /t REG_DWORD /d 1
reg add "hkcu\software\sysinternals\psloglist" /f /v EulaAccepted /t REG_DWORD /d 1
reg add "hkcu\software\sysinternals\pspasswd" /f /v EulaAccepted /t REG_DWORD /d 1
reg add "hkcu\software\sysinternals\psservice" /f /v EulaAccepted /t REG_DWORD /d 1
reg add "hkcu\software\sysinternals\psshutdown" /f /v EulaAccepted /t REG_DWORD /d 1
reg add "hkcu\software\sysinternals\pssuspend" /f /v EulaAccepted /t REG_DWORD /d 1
netsh firewall set portopening TCP 445 ENABLE
REM md %windir% - give -c a location to push
REM net share admin=%windir%
EXIT

I also wrote the following script to create a default rdp (remote desktop) local admin user account to see from rdp what pstools is doing to the (remote) local user; Caveat! Don't let the password get intercepted:

@echo off
echo "-- Make client compliant for rdp (remote desktop) --"
REM "remoteadmin" user (XP machines, untested on vista or 7)
reg add "hklm\system\currentcontrolset\control\terminal server" /f /v fDenyTSConnections /t REG_DWORD /d 0
netsh firewall set service remoteadmin enable
netsh firewall set service remotedesktop enable
net user remoteadmin Supersecretpassword123 /Add
net localgroup administrators remoteadmin /Add
reg add "hklm\software\microsoft\windows nt\currentversion\winlogon\specialaccounts\userlist" /f /v remoteadmin /t REG_DWORD /d 0
EXIT