Tuesday, September 9, 2014

Phone / iPod Won't Play Music Through Aux Port Anymore?

So I had an issue with my phone today, where no audio would play through the auxiliary port anymore. It was working fine in the morning, and then in the afternoon it just stopped.

I could get some audio to come out if I pressed down really hard with the aux jack, but as soon as I would let go, it was out again.

I was thinking the worse, when I thought to try and just clean it out.

Turns out that's all it was!

From keeping my phone in my pocket, the auxiliary port had gathered up quite a bit of pocket lent. I simply used a bent paper clip to clean it all out, and voila, it worked!

So if you're ever having this issue, try the above and hopefully it will resolve your issue.


Also, I originally used a tooth pick to dig some of it out, but then the tip broke inside so I had to dig that out too... So I would suggest not using a tooth pick for this very reason. A paperclip is the way to go.

Thursday, July 24, 2014

Launch of My New Web App - QuickVid - Imgur for Videos

It's finally here!

For the past couple of months I've been developing a web application to freely and instantly share videos without the need for an account. Basically Imgur for videos. I've finally got the working build online and you can check it out here http://quickvid.org. So if you ever just need to send a quick video to a friend and don't want to deal with signing into YouTube or creating an account, check it out. Also like the page, and follow the twitter if you want to help support the project!

http://facebook.com/QuickVid
https://twitter.com/quickvidd

Please, if you find any issues report them to me via the feedback page.

Comments, suggestions, and discussions welcome.

Wednesday, July 23, 2014

FFMPEG, Webm, libvpx, and Multithreading / Multiple Core Usage

Okay, so I've been developing a little web app to quickly share videos, and it's located here, if you want to check it out.

I am writing this very quickly, as I am already way passed the time I should be in bed from trying to figure this out! My boss won't be happy tomorrow.

Anyways,

Essentially, if you are trying to get ffmpeg to use multiple cores when converting to webm, and cannot for the life of yourself, figure out why it won't, then read this!

When using -threads <num of threads> you MUST put it right after -codec or wherever you declare your codec.

For example...

The following command will not work!

ffmpeg -threads 5 -i blah.mp4 -c:v libvpx -quality good blah.webm

but if you put the -threads 5 AFTER -cv libvpx it will use all your cores!

ffmpeg -i blah.mp4 -c:v libvpx -threads 5 -quality good blah.webm

I have no idea why this is the case, but I'm sure as hell happy it works.



Thanks to Jernej Virag from the comments on this post for finding this!

Wednesday, April 9, 2014

Avoiding XSS Vulnerability With $_SERVER['PHP_SELF']

Hey all,

Just wanted to add this little post to my blog about avoiding an exploit with using $_SERVER['PHP_SELF'].

For the longest time, I would use $_SERVER['PHP_SELF'] in my form action fields when the form parsing code was on the same page.

However, if not properly sanitized this function can easily be exploited.

Demonstration:

Here is a very simple html form with PHP processing on the same page. You will notice that the action of the form is the PHP_SELF server variable included within PHP.

This variable is pulled from the URL. Can you see the exploit?

<!DOCTYPE html>
<html>
<head>
<title>Form Exploit Demonstration</title>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post">
<input type="text" name="foo">
<br>
<button type="submit" name="submit">Submit</button>
</form>
<?php
if(isset($_POST['submit']))
{
echo htmlspecialchars($_POST['foo']);
}
?>
</body>
</html>

If the user edits the URL, the PHP_SELF variable becomes that edited information.



With this, you can escape the action attribute, end the form, and then execute all sorts of nasty bits of code.

Of course, my favorite being the following...

"</form><div style="position: absolute; top: 0px; bottom: 0px; right: 0px; left: 0px; background-color: black; color: white; text-align: center; font-size: 100px;">Hacked :)</div>

Which results in...



This vulnerability can be patched by simply using htmlspecialchars to sanitize the PHP_SELF variable, or by simply just not using it and just hard coding in index.php.