Skip to content

Instantly share code, notes, and snippets.

@donaldguy
Created December 19, 2013 03:04
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donaldguy/8033726 to your computer and use it in GitHub Desktop.
Save donaldguy/8033726 to your computer and use it in GitHub Desktop.
deobsfuscated http://becausetheinter.net/audio.js * Unrot13d comment on top * Spaced. * Replaced array access of encoded keywords with their values in place. * Switched from array-access to dot syntax. * Gave callable name to decode_str. * Assigned mnemonic names to other __0x variables
//Secret track
// -- removed _0xe7d4 keywords array
function playAudio(track_id) {
var audio_object = window.audioObjects[track_id];
if (audio_object) {
if (!audio_object.requestPlaying) {
audio_object.play();
} else {
audio_object.stop();
};
};
};
function restartAudio(track_id) {
var audio_object = window.audioObjects[track_id];
if (audio_object) {
audio_object.restart();
};
};
var decode_str = function (str) {
return (str ? str : this).split('').map(function (track_id) {
if (!track_id.match(/[A-za-z]/)) {
return track_id;
};
c = Math.floor(track_id.charCodeAt(0) / 97);
k = (track_id.toLowerCase().charCodeAt(0) - 83) % 26 || 26;
return String.fromCharCode(k + (c == 0 ? 64 : 96));
}).join('');
};
String.prototype['q4x'] = String.prototype['le3'] = String.prototype['a3q'] = decode_str;
var audioObject = function (id, encoded_filename, length) {
this.audio = null;
this.src = "http://static.becausetheinter.net/script/" + decode_str(encoded_filename) + ".mp3";
this.altsrc = "http://static.becausetheinter.net/script/" + decode_str(encoded_filename) + '.ogg';
this.duration = '--:-- / --:--';
this.requestPlaying = false;
this.id = id;
this.maxDuration = length;
var self = this;
this.play = function () {
if (window.audioObjectPlaying != null) {
window.audioObjectPlaying.stop();
};
if (self.audio == null) {
self.createAudioHooks();
};
self.audio.src = self.src;
if (!(typeof self.audio.canPlayType === 'function' && self.audio.canPlayType('audio/mpeg') !== '')) {
self.audio.src = self.altsrc;
};
self.audio.play();
self.requestPlaying = true;
window.audioObjectPlaying = self;
self.updateDisplay();
};
this.restart = function () {
self.end();
self.play();
};
this.isPlaying = function () {
return !self.audio.paused;
};
this.secondsToTime = function (secs) {
if (!isFinite(secs)) {
return '--:--';
};
var mins = Math.floor(secs / 60);
var secs_in_min = Math.floor(secs) - (mins * 60);
if (mins < 10) {
mins = '0' + mins;
};
if (secs_in_min < 10) {
secs_in_min = '0' + secs_in_min;
};
return mins + ':' + secs_in_min;
};
this.onDurationChange = function () {
var current_time_display = '--:--';
if (self.audio != null) {
if (self.audio.currentTime) {
current_time_display = self.secondsToTime(self.audio.currentTime);
};
var length_display;
if (self.maxDuration) {
if (self.maxDuration - self.audio.currentTime < 1) {
self.end();
};
length_display = self.secondsToTime(self.maxDuration);
} else {
length_display = self.secondsToTime(self.audio.duration);
};
self.duration = current_time_display + ' / ' + length_display;
self.updateDisplay();
};
};
this.stop = function () {
if (self.audio != null) {
self.audio.pause();
self.requestPlaying = false;
self.updateDisplay();
};
self.updateDisplay();
};
this.createAudioHooks = function (unused_arg) {
self.audio = new Audio(self.src);
if (!(typeof self.audio.canPlayType === 'function' && self.audio.canPlayType('audio/mpeg') !== '')) {
self.audio.src = self.altsrc;
};
self.audio.addEventListener('durationchange', self.onDurationChange);
self.audio.addEventListener('timeupdate', self.onDurationChange);
self.audio.addEventListener('pause', self.onDurationChange);
self.audio.addEventListener('ended', self.end);
};
this.end = function () {
self.stop();
self.audio.currentTime = 0;
self.onDurationChange();
self.stop();
self.audio.src = '';
};
this.updateDisplay = function () {
var play_btn = document.getElementById(self.id + '_PL');
var animation = document.getElementById(self.id + '_ANIM');
var progress = document.getElementById(self.id + '_PROG');
console.log(self.audio.networkState);
if (self.isPlaying()) {
if (play_btn) {
play_btn.src = 'http://static.becausetheinter.net/script/pause.gif';
progress.innerHTML = self.duration;
animation.src = 'http://static.becausetheinter.net/script/player.gif';
};
} else {
if (play_btn) {
if (self.requestPlaying) {
play_btn.src = 'http://static.becausetheinter.net/script/pause.gif';
} else {
play_btn.src = 'http://static.becausetheinter.net/script/start.gif';
};
progress.innerHTML = self.duration;
animation.src = 'http://static.becausetheinter.net/script/playerstop.gif';
};
};
};
if (window.audioObjects === undefined) {
window.audioObjects = new Object();
window.audioObjectPlaying = null;
};
window.audioObjects[id] = this;
};
function generatePlayer(track_id, encoded_title, encoded_filename, maxDuration) {
var html = '';
html += '<div class="player" id="' + track_id + '">';
html += '<div class="player_innerplayer">';
html += '<img class="player_playbutton" id="' + track_id + '_PL" src="http://static.becausetheinter.net/script/start.gif" onclick="playAudio('' + track_id + '')">';
html += '<div class="player_meta">';
html += '<span class="player_trackname">' + decode_str(encoded_title) + '</span><br/>';
html += '<span class="player_duration" id="' + track_id + '_PROG">--:-- / --:--</span></div>';
html += '<img class="player_resetbutton" id="' + track_id + '_RESET" src="http://static.becausetheinter.net/script/replay.png" onclick="restartAudio('' + track_id + '')">';
html += '<img class="player_animation" id="' + track_id + '_ANIM" src="http://static.becausetheinter.net/script/playerstop.gif"></div>';
if (maxDuration !== undefined) {
html += '<script>new audioObject("' + track_id + '","' + encoded_filename + '",' + maxDuration + ');</script></div>';
} else {
html += '<script>new audioObject("' + track_id + '","' + encoded_filename + '");</script></div>';
};
return html;
};
@donaldguy
Copy link
Author

@donaldguy
Copy link
Author

In original all local variables are named '_0x1bf6x' followed by a number that increments (not quite monotonically) across the file ranging from 2 to 18, though some values are perhaps omitted... could be significant?

@AdventuresOfMar
Copy link

Are you any good with PHP and mySQL?
I was trying to think if there is anyway to trick the static.becausetheinter.net database into giving access to the main users root file and see if there is a track 9 1/2 at all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment