Wednesday, January 7, 2015

Some Updates on My Personal Project - QuickVid - Imgur for Videos

So I said I would post updates on this, and I have yet to do so, so I will do it now!

Things are going okay with the site, traffic numbers are relatively still low (few hundred a day), and I'm obviously paying out of pocket to keep the server online.

There have been some uploads that were posted to Reddit that received quite a bit of traffic, and I'm hoping to see more of those in the future.

There's been a large amount of updates since I've last posted here, but some of my major achievements are the following...

- Complete site makeover and overhaul
- Added drag and drop to make it much, much, easier to upload
- Decreased upload time by 1/3 to maybe even half (still working on reducing this more)
- Rating system implemented
- Added a browse section to view public uploaded videos
- Insane amount of misc. fixes

You can check out the Reddit for all the updates at http://www.reddit.com/r/QuickVid/

And of course, the link to the site is http://quickvid.org

If you have any suggestions, please let me know in the comments or email me them. I'd love to hear feedback from people on this.

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.

Wednesday, September 12, 2012

Screenshots With PHP (GD2)

Found this neat technique to grab a screenshot of a window using PHP, and after some debugging, I was finally able to get it to work.

Here's how:

Note: I believe this only works on windows boxes. If I find a method for a Linux machine, I'll be sure to write something on that as well.

<?php

$browser 
= new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$browser->Navigate("http://www.libgd.org");

/* Still working? */

while ($browser->Busy) 
{
    
com_message_pump(4000);
}


$im = imagegrabwindow($handle, 0);
$browser->Quit();

imagepng($im, "iesnap.png");
imagedestroy($im);

?>

Running just this script alone won't get you the screenshot. You need to go into Windows services and allow whatever web server you are running to interact with the desktop. (If you do not do the below... the images will save as a black filled png file.)

To do this...

Right click 'My Computer' and click Manage.


Find the web server's service (I am using WAMP Server for this demonstration), right click it and hit properties.

Click the 'Log On' tab and check the 'Allow service to interact with desktop' box.

Restart Apache and you should now be able to use the above script. 


Oh, and if you want the image to not have the nasty Internet explorer scroll bars / menus add this to the script:

$browser->Fullscreen = true;

Script credits goes to: http://www.php.net/manual/en/function.imagegrabwindow.php

Thursday, August 23, 2012

WAMP and PHP's cURL Windows 7 x64 bit

I came across, yet another, issue with WAMP server (I'm beginning to question the usability of this application.)

Anyhow; the error I received, even after enabling the php_curl.dll extension, was the following:

'unable to load dynamic library php_curl.dll'

When I checked the Apache error log, I was shown this:


Warning:  PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.3.13/ext/php_curl.dll' - The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail. in Unknown on line 0.



The fix was to replace the php_curl.dll file in C:\wamp\bin\php\php5.3.13\ext with one of the following:


php_curl-5.3.13-nts-VC9-x64.zip
php_curl-5.3.13-VC9-x64.zip
php_curl-5.4.3-nts-VC9-x64.zip
php_curl-5.4.3-VC9-x64.zip



Credits go to the owner of this blog (Thank you!): http://www.anindya.com/php-5-4-3-and-php-5-3-13-x64-64-bit-for-windows/