Android Banshee Remote insecure!
by admin on Nov.30, 2009, under Programming
Hi all, a few weeks ago i started using the Banshee Remote for Android by Nikitas Stamatopoulos to control my music over my network via wifi. I downloaded the source code for the project and noticed it used a very insecure stateless server so i wrote a program to control my roommates banshee remote server. I have been fixing bugs on a local copy of the banshee remote server (stopping mostly crashes) which i will post in a while. Here is the code to control anyones banshee remote server
#!/usr/bin/env python
import os, sys, socket, getopt
def usage():
print("""usage: python bansheeserver-controller.py ip:port command\nCommands:
\tplayPause: Toggle pause/play
\tnext: Play next song
\tprev: Play previous song
\tmute: Mute volume\n""".format())
def commandBanshee((ip, port), command):
osock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
osock.connect((ip, port))
if command == 'playPause' or command == 'mute' or command == 'next' or command == 'prev':
try:
osock.send(command + '/')
except IOError:
print("Error sending data...")
osock.close()
return 1
else:
print("Command not understood!")
usage()
osock.close()
return 0
def main():
# parse command line options
try:
(opts, args) = getopt.getopt(sys.argv[1:], '')
except getopt.GetoptError, err:
print (str(err))
usage()
return 1
if len(args) == 2:
try:
(ip, port) = args[0].split(':')
command = args[1]
except:
print("Invalid arguments!")
usage()
return 1
return commandBanshee((ip, int(port)), command)
else:
usage()
return 1
if __name__ == '__main__':
sys.exit(main())
I also am planning on re-writing the server as a seamless server that requires authentication (so its secure) and integrate it into banshee using C#. Anyways i have to go study (its exam time soon :S).. Enjoy the code…
Update
by admin on Nov.27, 2009, under Uncategorized
Hi all, i’m sorry i haven’t posted in forever
As some of you may know i have been attending the University of Waterloo for computer science and mathematics since fall semester 2008. University is a immense amount of work! So my time has been mostly dedicated to that as well as a few family issues. But i am happy to say that you should be seeing regular posts again (at least once a week) on the many interesting things i run into a school (eg. implementation of a simple matrix manipulation library in c, topics in linear algabra, encryption (algebra), maybe a little calculus and of course, lots of computer science! Also notice if you have an android phone (or god forbid a iphone) i have optimised my blog for mobile viewing. Take a look on your phone. Anyways, i hope to hear back a few comments and sorry for my neglect!
Ubuntu 8.04 Hardy Heron Released! And an interesting problem
by admin on Apr.25, 2008, under Uncategorized
Hi all, for those of you who do not already know, the new version of ubuntu (8.04) was released yesterday
. I know today i will be doing my switch and will do a little write up. But for now you can read a wired review!
Also two days ago i came up with an interesting problem. Here it is: Given a function f(x)=x^2 how many lines can intersect f(x) such that the area between the functions is 1? I have been working at a solution, but the answer may be infinite! If anyone knows a way to solve this problem let me know
Anyways thanks for reading this short update
and enjoy the new ubuntu 8.04!!!
Finding Prime Factors
by admin on Apr.07, 2008, under Programming
This week i have been moderately busy with work and school. But on my spare time i have been working away at the problems on Project Euler…on my way to a solution i came up with a neat little program (which i wrote in C++) to find the prime factors of a number. Here it is:
/*
* Author: Collin Doering
* Date Completed: April 3, 2008
* Version: 1.0
*/
#include <iostream>
#include <stdlib.h>
using std::cout;
using std::endl;
using std::cin;
/*
* Determines if a given parameter is prime
*/
bool isPrime(int num) {
for (int x = 2; x != ((num / 2) + 1); ++x) {
if ((num % x) == 0) {
return false;
}
}
return true;
}
/*
* Returns the largest prime divisor of a given number
*/
int largestPrimeDivisor(int num) {
int x = 0;
for (x = num; x > 0; --x) {
if ((num % x) == 0) {
if (isPrime(x)) {
break;
}
}
}
return x;
}
/*
* Start of execution
*/
int main(void) {
int x = 0; //last prime factor
cout << "Enter a integer:" << endl;
for (x = 123456; !isPrime(x); x /= largestPrimeDivisor(x)) {
cout << largestPrimeDivisor(x) << endl; //output each prime factor
}
cout << x << endl; //output last prime factor
getchar();
return 0;
}
The only thing is that i have to find the largest prime factor of the number 600851475143…which is larger then any number type in C++..so i am a little stuck on how i am going to solve the problem..anyways..once i do find a solution i will post it and explain..for now i just thought i would show my neat little program
Thanks for the read
Sorry, and a new Web Host!
by admin on Mar.22, 2008, under Personal
First off i would like to say i am so sorry i did not notify readers that i was going to be going down! It was actually a surprise to me too! My previous provider Network Solutions did not receive my payment so they put my website down until they reveived it. I have been looking to find more support and i found HostPapa. I looked at their services and they offered a lot more for a lot less! SO i decided to switch; the past week i have been getting everything moved over. As you can probably see i have got a everything up and running as normal. Since i was down i have actually done a lot of work on my upcoming sub-domains wiki, and chat (note: the sub-domains are not accessable by the form (subdomain.rekahsoft.org) just yet because the domina transfer is still in the works; by next week it should be up and running). I have set up a simple online chat client(just for fun) and a wiki. Note that there is not yet data published on the wiki but it is coming. Topics will include Computer Science and Math. Also i have set up a experimental joomla CMS just for myself to try. Many updates to come, so stayed tuned. Also i would very much apreciate any comments on the blog and things that you would like to see. Also any comments on Joomla/Math/Technology would be encouraged. Regards and sorry for the down time.
IMAP, KDE 4, Gnome, Programming and of course an update
by admin on Feb.19, 2008, under Personal, Programming
Sorry to all my readers that i have not been blogging as often. I know it has been way way too long just i have been keeping busy with school…my marks have been submitted for university. My average was 83%; i applied at the University of Waterloo for Computer Science, Pure Mathematics, and Computer Engineering. So hopefully i will get in. Anyways, this post has been sitting as a draft for way too long so again, i am so sorry that i have not been posting as often. I am going to be changing web hosting hopefully within the month. The reason being i want more support for things like PHP 5, unlimited email space and accounts, etc..
Also to those of you who do not know, KDE 4 has been released. Since i have been behind a couple weeks i have not been able to give my opinion of it yet. To tell the truth i have not even tried it yet! Reason being that i have actually switched completely back to gnome. I also have as of late bought some new programming books
. “The Gnome 2 Developers Guide” by No Starch Press, “C in a Nutshell” by O’Reilly and “Designing User Interfaces” again, by O’Reilly. So basically i have been learning more C so i can get started with learning the Gnome C libraries. Also i recently have found a site that unites my two passions. The site is called Euler Project and has some very interesting problems that require math and programming to solve
A note to all my readers that i am going to be switching hosting hopefully before the end of the month so more features (a wiki, and more) are upcoming. Also not i am going to be updating this a lot more regularly so expect more!
NetBeans 6.0 Released!!!
by admin on Dec.04, 2007, under Java, Netbeans, Programming
Just a quick post to let those of you who don’t know yet…Netbeans 6.0 is out
I am going to try it tonight so expect screenshots and a review soon…I have been waiting for this release for quite some time
My Beautiful Discovery of Matrices
by admin on Nov.18, 2007, under Programming
Hi all, as of late i have been quite busy with school; unfortunately in my grade 12 math courses matrices are not gone over for more then one class or so, thus leaving one with little knowledge about their power and the immense amount of fun they are. So on my spare time i decided i would use good ol’ wikipedia to cure my craving for knowledge. After about 5 hours of straight reading learning and solving i decided that my matrices knowledge was pretty good…o and of course i was quite hungry. The time flew by while i was learning…i started working and the next time i looked at the clock it was 5 hours later
…anyways i thought i would just show some cool things about what i learned:
Given: x + y + z = 6, 3x + 2y + z = 10, x + 3y +2z = 13
Which can for the following Matrix:
---------------
1 1 1 | 6
3 2 1 | 10
1 3 2 | 13
---------------
Now, by using some elementary row operations we can simplify the matrix above to row echelon form by using Gaussian elimination, after which the matrix would look like the following:
------------------
1 1 1 | 6
0 1 1/2 | 7/2
0 0 3/2 | 9/2
-----------------
After which, we simplify to reduced row echelon form which will look like the following:
---------------
1 0 0 | 1
0 1 0 | 2
0 0 1 | 3
---------------
Therefore we know our answers are: z = 3, y = 2, x = 1
Pretty neat eh
There are many more ways to solve linear equations any more methods of doing so. For more info see this.
Updated to Wordpress
by admin on Nov.17, 2007, under C/C++, Java, Netbeans, Personal, Programming, Uncategorized
Hi all, hopefully by this time you have noticed that i have changed over to wordpress…i am still doing some configuration but in due time i hope to have this installation working as well as my drupal installation. Thanks for reading; more to come.
Update: As many of you have seen i have kept the same theme as i had on my drupal installation so nothing is really different from a users point of view besides some things are missing.