- GRAYBYTE UNDETECTABLE CODES -

403Webshell
Server IP : 184.154.167.98  /  Your IP : 18.117.74.47
Web Server : Apache
System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
User : puertode ( 1767)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/puertode/public_html/contratos/apps/logreader/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/puertode/public_html/contratos/apps/logreader/js/ExceptionParser.js
import unserialize from './unserialize';

window.unserialize = unserialize;

export class ExceptionParser {
	isException (logMessage) {
		return this.isNewStyleException(logMessage) || this.isOldStyleException(logMessage) || this.isBackgroundJobException(logMessage);
	}

	isNewStyleException(logMessage) {
		return logMessage.Exception;
	}

	isOldStyleException (logMessage) {
		return logMessage.substr && logMessage.substr(0, 12) === 'Exception: {';
	}

	isBackgroundJobException (logMessage) {
		return logMessage.substr && logMessage.substr(0, 34) === 'Error while running background job' && logMessage.indexOf('{"Exception":') !== -1;
	}

	parse (logMessage) {
		if (this.isNewStyleException(logMessage)) {
			return logMessage;
		}
		let data;
		if (this.isOldStyleException(logMessage)) {
			try {
				data = this.tryParseJSON(logMessage.substr(10));
			} catch (e) {
				console.log('Error while parsing exception:');
				console.log(logMessage.substr(10));
				console.error(e);
			}
		} else {
			data = this.tryParseJSON(logMessage.substr(logMessage.indexOf('{"Exception":')));
			const messageHead = logMessage.substr(0, logMessage.indexOf('{"Exception":'));
			const jobDataString = messageHead.split('(', 2)[1];
			const jobDataParts = jobDataString.split(',', 2).map(part=>part.trim());
			data.jobClass = jobDataParts[0].split(':', 2)[1].trim();
			data.jobArguments = jobDataParts[1].substr(10).trim();
			window.s = jobDataParts[1].substr(10).trim();
			if (data.jobClass === 'OC\\Command\\CommandJob') {
				try {
					[data.jobClass, data.jobArguments] = this.parseCommandJob(data.jobArguments);
				} catch (e) {
					
				}
			}
		}
		let traceLines = data.Trace.split('\n');
		data.Trace = traceLines.map(this.parseTraceLine);
		return data;
	}

	tryParseJSON(json) {
		try {
			return JSON.parse(json);
		} catch (e) {
			// fix unescaped newlines
			json = json.replace(/\n/g, '\\n');
			// fix unescaped namespace delimiters
			json = json.replace(/([^\\])\\([A-Z{])/g, '$1\\\\$2');
			try {
				return JSON.parse(json);
			} catch (e) {
				console.log('Error while parsing exception:');
				console.log(json);
				console.error(e);
			}
		}
	}

	parseCommandJob (data) {
		const parsed = unserialize(data);
		return [parsed['class'], parsed.properties];
	}

	parseTraceLine (line) {
		let parts = line.split(' ');
		let number = parts.shift();
		let traceData = parts.join(' ');
		parts = traceData.split(':');

		if (parts.length > 1) {
			let file, lineNumber;
			let fileAndLine = parts.shift();
			let call = parts.join(' ');
			if (fileAndLine[0] === '[') {
				lineNumber = false;
				file = fileAndLine;
			} else {
				let filePaths = fileAndLine.split('(', 2);
				file = filePaths[0];
				lineNumber = filePaths[1].substr(0, filePaths[1].length - 1);
			}
			return {
				'function': call,
				number: number,
				file: file,
				line: lineNumber
			};
		} else {
			return {
				'function': traceData,
				number: number,
				file: false,
				line: false
			};
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit