Droid-Break – high quality alternatives to proprietary Android apps

Posted on 23. Oktober 2013 Comments

After the NSA scandal 2013 the website prism-break.org got a little famous for recommending software, that would help keeping snooping intelligence services out of your private conversations. There are a couple of proprietary solutions, because there are just no alternatives but it’s mostly free and open source software(FOSS). While the disclaimer says „this site will not guarantee that 100% of your communications will be shielded against surveillance states“ it’s probably the best you can do. So that got me thinking and I created droid-break.info.

Prism-break.org lists a couple of Android apps, but only to security related issues such as encryption. Droid-Break is about FOSS apps in general because – as it turned out – for most of the apps we use everyday there is a good alternative FOSS solution. Most of the apps are in the F-Droid app store so you don’t have to rely on Google doing no evil.

The list includes the following categories: Browser, Social Networks, Messenger, VoIP, Audio/Podcasts, Video, Email, Notes, News Reader, File Manager, Navigation, Keyboards, Cloud, and a category for misc app that didn’t fit anywhere else.

If you have any suggestions, write a comment, an e-mail, tweet @repat123 or @droidbreak or fork the project on github.

Btw, it’s kindly hosted by neocities.org 🙂

Owncloud News Reader Error after update to 5.0.11

Posted on 21. Oktober 2013 Comments

After updating to owncloud 5.0.11 I got the following error in my Owncloud News Reader:

Screenshot_2013-10-21-10-20-56

(For Google: A Toast saying „End of input at line 1 column 1“)

In my owncloud instance, I got an error in the administrator menu saying:

SQLSTATE[HY000]: General error: 1 no such column: feeds.articles_per_update at db.php#391

I updated the owncloud instance and app framework/news app but it still showed me that everything was uptodate, even when 5.0.12 was released. Via phpMyAdmin I could see that the feeds were still in the database but I couldn’t see them in the web app or Android app. So I just deleted the owncloud folder, downloaded the new .tar.bz2 from owncloud.org, removed the oc_news tables(do not delete e.g. the contacts or bookmarks!). Then I changed my username in oc_users, used my old username as my new username and reinstalled owncloud, this time version 5.0.12.  I could then delete the old (changed) username via the admin panel.

This is the third time I had to reinstall owncloud, because the update mechanism didn’t work properly… And yes, as advised, I did deactivate the news app and app framework for the update process 😉

I just had a look at the SQL-statements from my last backup and saw that articles_per_update is supposed to be a column in oc_news_feeds in the new version of the news app. Somehow, the owncloud update process didn’t update the news app or didn’t trigger a 3rd-party update process. Anyways, I guess this could also be solved by just adding this column manually:
`articles_per_update` bigint(20) NOT NULL DEFAULT '0'

MRBS: Check if user has booked 2 rooms at the same time

Posted on 17. Oktober 2013 Comments

This little function checks if the same user has booked $room1 and $room2 at the same time.

function checkForSameUser($room1,$room2,$user,$starttime,$endtime,$tbl_entry) {
$sql = "SELECT id, name, start_time, create_by, status
FROM $tbl_entry
WHERE start_time < $endtime
AND end_time > $starttime
AND (room_id=$room1 OR room_id=$room2)
AND create_by=\"$user\"";
$res = sql_query($sql);
if (empty($res))
{
// probably because the table hasn't been created properly
trigger_error(sql_error(), E_USER_WARNING);
fatal_error(TRUE, get_vocab("fatal_db_error"));
}
if (sql_count($res) != 0)
{
sql_free($res);
return "error";
}
}

 

You can use it e.g. in mrbs_sql.inc in the function mrbsCheckFree(..) to check if a user is allowed to book a certain room like this.

// 1 and 2 are the roomIDs
$result = checkForSameUser(1,2,$user,$starttime,$endtime,$tbl_entry);
if ($result == "error"){
$err[] = get_vocab("multiple_rooms");
return $err;
}
}

As you can see the first function returns the string „error“ in case an error occured. I translated the string for multiple_rooms in every language used on this MRBS system and edited the the lang.x file in the main folder, e.g. lang.de:

$vocab["multiple_rooms"] = "Mehrere Räume können nicht gleichzeitig vom selben User gebucht werden";

MRBS: Show email address instead of username

Posted on 17. Oktober 2013 Comments

Oftentimes people use MRBS with an LDAP directory and the users have identifiers that don’t fit their real names. MRBS uses these identifiers publicly to show who reserved a room.

I see 2 problems here: if the MRBS website is public, attackers get valid usernames(although this is more obscuring than actually making it more secure), and in case users want to discuss the usage of meeting rooms, they don’t know who to talk to. In my opinion, the email address would be much more helpful.

So I had a look at the sourcecode(v. 1.8.4) and edited the following lines:

file: functions_view.inc
line: 149 ..

// This was the original code
// $tbody .= create_details_row(get_vocab("createdby"), $data['create_by'], $as_html, $class);
// This is what I made out of it
$mail = authLdapGetEmail($data['create_by']);
$tbody .= create_details_row(get_vocab("createdby"), $mail, $as_html, $class); 

Set Window position under Windows 7

Posted on 10. Oktober 2013 Comments

Apparently there is no way of setting/configuring a windows position on the screen. I couldn’t find a place to define X and Y or top and left. There is however  a function, if you write your own application in C++(SetWindowPos). Also deleting [-HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\BagMRU] and the like didn’t work for me, especially since the (current) user, wasn’t allowed to use regedit.

Thanks to paradroid on superuser.com, I found another, reasonably usable solution: Hold down CTRL while clicking on the [X]-button of a window. Windows will then remember the position for the next start.

-.-

Update to the latest scala version with Ubuntu 12.04 Precise Pangolin

Posted on 7. Oktober 2013 Comments

Basically the wiki at summercode.com says it all, go to (or wget) the latest version at http://www.scala-lang.org/download and untar it. Then move the folder to /usr/share/scala. Then link the address of the new binaries to the old binaries in /usr/bin. The main problem here is that you have to delete them first so I just want to add this little piece of shellscript(including the instructions from the tutorial mentioned above):

$ wget http://www.scala-lang.org/files/archive/scala-2.10.3.tgz
$ tar zxf scala-2.10.3.tgz
$ sudo mv scala-2.10.3 /usr/share/scalasudo rm /usr/bin/scala
$ sudo rm /usr/bin/scalac
$ sudo rm /usr/bin/fsc
$ sudo rm /usr/bin/sbaz
$ sudo rm /usr/bin/sbaz-setup
$ sudo rm /usr/bin/scaladoc
$ sudo rm /usr/bin/scalap
$ sudo ln -s /usr/share/scala/bin/scala /usr/bin/scala
$ sudo ln -s /usr/share/scala/bin/scalac /usr/bin/scalac
$ sudo ln -s /usr/share/scala/bin/fsc /usr/bin/fsc
$ sudo ln -s /usr/share/scala/bin/sbaz /usr/bin/sbaz
$ sudo ln -s /usr/share/scala/bin/sbaz-setup /usr/bin/sbaz-setup
$ sudo ln -s /usr/share/scala/bin/scaladoc /usr/bin/scaladoc
$ sudo ln -s /usr/share/scala/bin/scalap /usr/bin/scalap

Or download the file here: update-scala.sh (github clone)

SQLDeveloper with Ubuntu 12.04, alien and the .rpm-file

Posted on 30. September 2013 Comments

There are a couple of tutorials[1] of how to install Oracles SQLDeveloper and they all say to install the sqldeveloper-XXX-no-jre.zip, in this case sqldeveloper-3.2.20.09.87-no-jre.zip. I didn’t read it because my first idea was the following and it also worked: It’s possible to download the .rpm-file and convert it with alien. You might have to install it with

sudo apt-get install alien

then

alien sqldeveloper-3.2.20.09.87-1.noarch.rpm
dpkg -i sqldeveloper_3.2.20.09.87-2_all.deb

You can then start the sqldeveloper. It will ask you for the Java Path which is usually /usr/lib/jvm/java-6-openjdk and give you some kind of error, which didn’t seem to have any impact.

repat@laptop:~$ sqldeveloper
Oracle SQL Developer
Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
Type the full pathname of a J2SE installation (or Ctrl-C to quit), the path will be stored in ~/.sqldeveloper/jdk
/usr/lib/jvm/java-6-openjdk
/opt/sqldeveloper/sqldeveloper/bin/../../ide/bin/launcher.sh: Zeile 455: /home/repat/.sqldeveloper/jdk: Datei oder Verzeichnis nicht gefunden

[1] e.g. Oracle Forum, Linux Sagas, Software in a bottle

Simple MRBS Output from Database

Posted on 17. September 2013 Comments

I wrote a little PHP-script that extracts the most important and current data from MRBS’s MySQL database and just prints them in a simple HTML file. Its not pretty but good for bandwith and clarity. We use it to display information on an energy efficient e-ink screen in front of conference/computer rooms.

$date is set like this:

$date = date("Y-m-d");

The SELECT-statements go like this, where N is the ID of the room(in the database, not what you might call it)

SELECT name,description,from_unixtime(start_time),from_unixtime(end_time) FROM mrbs_entry WHERE from_unixtime(start_time) LIKE '%" . $date . "%' AND room_id = N;

I’m not gonna explain here how to establish a database connection in PHP, but you can have a  look at the whole sourcecode at github 😉

I then cut off the date with substr() because it’s always 10 characters in front of time->(YYYY-MM-DD) and printed it via echo. This is the simple version, there is a version with tables on github.

while($row=mysql_fetch_row($qry01)) {
echo "- <strong>Room</strong> 01 | <strong>Desc:</strong>" . $row[0]." - ".$row[1]." |  <strong>Time:</strong> ". substr($row[2],10) . " - " . substr($row[3],10) . " <br />";
}

update: I wrote another version that prints JSON objects which can be parsed on the other side. For easier parsing(e.g. if everything is in one String) I numbered them:

$jsonarray = array('begin' . $i => substr($row[2],11, 5), 'end' . $i => substr($row[3],11,5), 'name' . $i => $row['name'], 'description' . $i =>  $row['description']);

You’ll find the whole thing on github.

crond mit busybox auf einem nook simple touch

Posted on 9. August 2013 Comments

Ich habe einen Nook gemäß den Anleitungen von nookdevs.org gerootet. Danach ist busybox, eine Sammlung von Unix-Tools, verfügbar(update: falls nicht: nachinstallieren). Eines dieser Tools ist der Scheduler cron, mit dem sich regelmässig Tasks ausführen lassen. Ich setzt hier vorraus, dass das Android SDK/ADT installiert ist und ihr root-Zugriff über USB habt.

$ adb shell

# cd /system/bin

Unter /system/bin habe ich ein paar Skripte hinterlegt mit denen er Crons starten und beenden kann. Die Zeit ist wichtig, damit er das auch zu eurer Zeit ausführt, nicht  UTC oder wie auch immer.

#cat startcron
export TZ=Europe/Berlin
busybox crond -f -c /data/cron &

Die verschiedenen Crondienste stehen in der Datei /data/cron/root. Damit ich nicht immer diesen langen Befehl aufrufen muss gibt es dafür ebenfalls ein Shortcut dafür.

#cat editcron
busybox vi /data/cron/root

Zum Beenden benutze ich ganz einfach brutal den killall-Befehl

#cat killcron
busybox killall crond

parallel-ssh mit perl

Posted on 9. August 2013 Comments

Es gibt ja das Programm parallel-ssh auf googlecode und auch in diversen Repositories, z.B. für Ubuntu. Ich habe allerdings dieses simple Perl Skript geschrieben um ein ähnliches Ergebnis zu erzielen. Da ich das über Webmin für ein bestimmtes Subnetz benutzen möchte, habe ich es konfigurierbar gehalten und das letzte Octect einer IP angegeben. Dabei ist mein Ziel hier gewesen, mich mit dem PublicKey-Verfahren anzumelden und eine bestimmte Datei oder einen Befehl auszuführen.

#!/bin/perl
$begin  = shift @ARGV;
$end    = shift @ARGV;

# if only one parameter given, only that IP will be used in the for-loop
if ($end == "") {
  $end = $begin;
}

# check if valid IPv4 address
if ($begin > $end || $begin > 255 || $end > 255 || $begin < 0 || $end < 0) {
  die "Die erste Zahl muss groesser als die zweite Zahl sein und muss eine Zahl zwischen 0 und 255 sein.\n ";
}

for (my $i = $begin; $i <= $end; $i++) {
  $bastelstring = "ssh user\@1.2.3." . $i . " befehl";
  $return = `$bastelstring`;
  print $return . "\n";
}

 

Alternativ kann man auch z.B. fest konfiguriert ein Array definieren:

 

@IPs = ("192.168.1.2", "192.168.1.3", "192.168.1.4");

foreach $IP(@IPs) {
  $bastelstring = "ssh user\@" . $IP . " befehl";
  $return = `$bastelstring`;
  print $return . "\n";
}