Hi all,
I've recently started developing a new scripting language. It uses a single interpreter and so far works pretty well. It's a mixture of C, C#, Ruby, Python, Perl and even some PHP.
Normally I wouldn't have bothered with such an idea, but to make pen testing and linux administration easier I just had to. All of the above languages can perform these two, but I find some things easier from, say, Perl, then some from Ruby and some of these look good from PHP, if you know what I mean. Anyway, to make my life easier I created one and working on having functions for something that would normally take 50 lines of Ruby, then neatly packages it in a hash table for you. A WORKING example is below titled dnscheck.cx. It basically takes a domain name the user specifies from the command arguments and checks the MX records - priority and name, then the nameserver for the domain. There is some simple error checking in there also. func main()
is always the constructor for this language and argv[], argc is automatically passed to it. You'll notice the ns_* functions. ns_mx() will get the MX records and add them to a hash table in the format of hostname => priority
and ns_ns() will get the nameserver records - nameserver => ipaddr
. It also uses is_ip()
which will validate an ip address for you. Obviously it has others that aren't listed here like md5()
, sha2()
, is_mail()
and many others. Because they are held in hashes you can quite easily iterate through them with foreach
.
Basically, I'm just wondering if anyone thinks this project is a good idea, or a complete waste of time.
I understand other languages have frameworks and modules, but with this language it's all-in-one; no imports, no rubygems, no requires, no CPAN etc. Any input is welcomed - Positive, or otherwise. Thanks a lot, and the working sample for dnscheck is below.
func runScan(domain)
{
Console.Printf("* Checking MX Records...\n");
mhash = ns_mx(domain);
if (!mhash)
{
Console.Printf("Problem getting mail records for %s\n", domain);
System.exit(1);
}
foreach(mhash as s,p)
{
Console.Printf("%d - %s\n",p,s);
}
Console.Printf("* Checking Nameservers...\n");
nhash = ns_ns(domain);
if (!nhash)
{
Console.Printf("Could not retrieve nameservers for %s\n", domain);
System.exit(1);
}
foreach(nhash as n,a)
{
Console.Printf("%s - %s\n",n,str(a));
}
}
func doCheck(addr)
{
if (is_ip(addr))
{
runScan(host(addr));
} else {
runScan(addr);
}
}
func main()
{
if (argc < 2)
{
Console.Printf("Usage: %s <host/ip>\n",argv[0]);
System.exit(1);
} else {
doCheck(argv[1]);
}
}