mirror of
https://github.com/horsicq/Detect-It-Easy.git
synced 2026-06-24 01:54:08 +00:00
28 lines
706 B
Text
28 lines
706 B
Text
// Retrieve the interpreter from a #! script.
|
|
|
|
var sInterpreter;
|
|
if(typeof sInterpreter==="undefined")
|
|
{
|
|
sInterpreter="";
|
|
var sLine=Text.getString(0);
|
|
// Make the expression a little easier to deal with by translating
|
|
// something like "/usr/bin/env perl" to just "/usr/bin/perl".
|
|
sLine=sLine.replace(/\/env\s+/,"/");
|
|
var aMatch=sLine.match(/#!.*\/(.+?)(?:\.exe)?\s/);
|
|
if(aMatch)
|
|
{
|
|
sInterpreter=aMatch[1];
|
|
}
|
|
}
|
|
|
|
// Check for a particular interpreter.
|
|
function isInterpreter(sString)
|
|
{
|
|
if(sInterpreter==sString)
|
|
{
|
|
// Found it, so blank it out to stop "script.2" picking it up again.
|
|
sInterpreter="";
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|