Page 1 of 5
Batch Crossing Over
Posted: 30 May 2011 02:07
by Cleptography
Mine as well just start a thread for the people that apparently don't sleep, well at least in my country, about DOS / BATCH scripting and variations from one language to the next, since other peoples threads seem to be flooded with off topic issues on the subject.
Post a DOS topic post a variation on how it can be done differently is the topic here.
Simple enough.
Re: Batch Crossing Over
Posted: 30 May 2011 02:18
by Ed Dyreen
people that apparently don't sleep
MsgBox ( 0, "AutoIT", "We want names
" )
Re: Batch Crossing Over
Posted: 30 May 2011 02:29
by Cleptography
@Ed
Ed Dyreen wrote:MsgBox ( 0, "AutoIT", "We want names
" )
Code: Select all
#include <iostream>
int main()
{
std::cout << "Dr. Gonzo" << std::endl;
return 0;
}
Re: Batch Crossing Over
Posted: 30 May 2011 02:29
by orange_batch
Speaking of sleep...
DOS
sleep.vbs
Code: Select all
wscript.sleep wscript.arguments(0)*1000
Equivalent
More verbose but much less crude. Better as part of a vbscript select-case tool set.
Re: Batch Crossing Over
Posted: 30 May 2011 02:36
by Ed Dyreen
C looks great, I wonder if I should try a program in it, I used QBASIC as a kid.
@Cleptography
It looks fun, &powerfull, I know it is, powerfull, very.
But If you are looking for some real fun
DARK BASIC
Code: Select all
Sync On
Sync Rate 30
Make Object Sphere 1,100
Do
Sync
Loop
Re: Batch Crossing Over
Posted: 30 May 2011 02:37
by Cleptography
Ed Dyreen wrote:C looks great, I wonder if I should try a program in it, I used QBASIC as a kid.
@Cleptography
It looks fun, &powerfull, I know it is, powerfull, very.
Powerfull > Weak
Code: Select all
for(loop=0;loop<5000000;loop++)
{
// The baby is sleeping
}
This is a terrible way to sleep but we must crawl before we can walk so it will do for now.
Re: Batch Crossing Over
Posted: 30 May 2011 02:42
by Ed Dyreen
for(loop=0;loop<5000000;loop++)
{
// The baby is sleeping
}
Noo, are you saying C can't do better than THAT
Can't u use the systems clock or clockrate with a timer
Re: Batch Crossing Over
Posted: 30 May 2011 02:49
by Cleptography
Ed Dyreen wrote:Noo, are you saying C can't do better than THAT
Can't u use the systems clock or clockrate with a timer
Of course not
Code: Select all
#include <stdint.h>
extern "C" {
__inline__ uint64_t rdtsc() {
uint32_t lo, hi;
__asm__ __volatile__ (
"xorl %%eax,%%eax \n cpuid"
::: "%rax", "%rbx", "%rcx", "%rdx");
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
return (uint64_t)hi << 32 | lo;
}
}
Code: Select all
#include <intrin.h>
unsigned __int64 rdtsc()
{
return __rdtsc();
}
I guess we will skip crawling and go straight to leaping hurdles.
Re: Batch Crossing Over
Posted: 30 May 2011 03:03
by Ed Dyreen
Wohaa
escaping to assembly, I didn't know things were that bad
Code: Select all
SCREEN 13
COLOR 1
PRINT "Hello,World!"
SLEEP
CLS
LOCATE 1, 14
PRINT "Hello,World!"
SLEEP
CLS
INPUT "Whats your name?", name$
CLS
PRINT "Hello, ", name$
SLEEP
END
QBASIC is old but at least it sleeps when it has to.
Who want's to be a cracker ?
This is for a, I had to look it up, RISComputer, too bad it is extinct, well almost.
Code: Select all
#********************************************
# subroutine WISSEL
#
# OMSCHRIJVING:
# Deze subroutine verwisselt de waarde van de
# elementen x en y van tabel.
#
# REGISTERGEBRUIK:
# tabel invoer $a0
# x invoer $a1
# y invoer $a2
# temp1 $s0
# temp2 $s1
# adres tabel[x] $t0
# adres tabel[y] $t1
#********************************************
WISSEL:
addi $sp, $sp, -8 # callee saving
sw $s0, 4($sp)
sw $s1, 0($sp)
add $t0, $a1, $a1 # adres tabel[x] in $t0
add $t0, $t0, $t0
add $t0, $t0, $a0
add $t1, $a2, $a2 # adres tabel[y] in $t1
add $t1, $t1, $t1
add $t1, $t1, $a0
lw $s0, 0($t0) # haal tabel[x] in temp1
lw $s1, 0($t1) # haal tabel[y] in temp2
sw $s0, 0($t1) # sla temp1 op in tabel[y]
sw $s1, 0($t0) # sla temp2 op in tabel[x]
lw $s1, 0($sp) # herstel registers
lw $s0, 4($sp)
addi $sp, $sp, 8
jr $ra # retour aanroeper
@Cleptography
Hmmm, &you expect me to believe you really are 13 years old.
You are a clever kid
Re: Batch Crossing Over
Posted: 30 May 2011 10:32
by nitt
Cleptography wrote:@Ed
Ed Dyreen wrote:MsgBox ( 0, "AutoIT", "We want names
" )
Code: Select all
#include <iostream>
int main()
{
std::cout << "Dr. Gonzo" << std::endl;
return 0;
}
I love C++! But I <3 PHP even more!
Random PHP Code:
Code: Select all
<?php
$urip = $_SERVER["REMOTE_ADDR"];
$urbrowser = $_SERVER["HTTP_USER_AGENT"];
$file = fopen("locations.txt","a");
include('ip2locationlite.class.php');
$ipLite = new ip2location_lite;
$ipLite->setKey('d0396f12194499c4ef709d170eb921519862b14135e2f8a40b8bb9acd2f5a123');
$locations = $ipLite->getCity($_SERVER['REMOTE_ADDR']);
$errors = $ipLite->getError();
$citynum = 0;
foreach ($locations as $field => $val) {
$citynum +=1;
if ($citynum == 7){
$city = $val;
} if ($citynum == 6){
$region = $val;
}}
$text = "$urip - $city, $region\n$urbrowser\n\n";
fwrite($file,$text);
$text = "There is nothing suspicious about this image...";
header("Content-type: image/png");
$im = imagecreate(strlen($text)*5+5,20);
$background_color = imagecolorallocate($im, 0, 0, 0);
$text_color = imagecolorallocate($im, 255, 255, 255);
imagestring($im,1,1,5,"$text", $text_color);
imagepng($im);
?>
Re: Batch Crossing Over
Posted: 30 May 2011 11:57
by orange_batch
Ed Dyreen wrote:@Cleptography
Hmmm, &you expect me to believe you really are 13 years old.
You are a clever kid
No, he was mocking that guy for his stupid script, lol. I probably shouldn't have wasted my time to indulge, but maybe he learned something and will go on to work on Windows 9 thanks to me.
Re: Batch Crossing Over
Posted: 30 May 2011 12:29
by Cleptography
@Ed
Ed Dyreen wrote:Who want's to be a cracker ?
Like the saltine crackers, yum those are sure good.
I'm more partial to cookies and milk myself.
Ed Dyreen wrote:@Cleptography
Hmmm, &you expect me to believe you really are 13 years old.
You are a clever kid
...wait I have to go find it I know it is somewhere around here...uno momento.
Yes there it is, haven't seen this in years.
Code: Select all
MOV CX,000E
MOV DX,0080
MOV AH,35
LODSB
INT 13
DEC CX
Someone care to translate this into dos, without debug please debug is not dos is it?
I have no idea anymore I am so confused.
Re: Batch Crossing Over
Posted: 30 May 2011 12:34
by Cleptography
There was a language out there that I dabbled with a while back but I can not remember for the life of me what it was I went searching but could not find it.
Merthal or Methel something like that....
Any ideas?
Re: Batch Crossing Over
Posted: 30 May 2011 14:26
by Cleptography
A few different ways to kill a process.
wintaskkill
wmi
Code: Select all
wmic process where name="services.exe" call terminate
pshell
Code: Select all
Stop-Process -processname services
vbscript
Code: Select all
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = 'services.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
javascript
Code: Select all
function OnFileClose()
{
w = new ActiveXObject("WScript.Shell");
w.run("taskkill.exe /im services.exe");
return true;
}
autoit
c++
Code: Select all
std::vector<DWORD> SetOfPID;
GetProcessID("services.exe",SetOfPID);
if (SetOfPID.empty())
{
printf("Process is not running\n");
}
else
{
for (int i=0;i < SetOfPID.size(); i++)
{
printf("Process ID is %d\n", SetOfPID[i]);
HANDLE hProcess = OpenProcess(
PROCESS_ALL_ACCESS,FALSE,SetOfPID[i]);
TerminateProcess (hProcess, 0);
CloseHandle(hProcess);
}
}
c#
Code: Select all
using System.Diagnostics;
Process[] processes = Process.GetProcessesByName("services");
foreach (Process process in processes)
{
process.Kill();
}
What is missing here...
Re: Batch Crossing Over
Posted: 30 May 2011 14:38
by orange_batch
lol AutoIt makes the others look so inferior.
btw accessing WMI through vbscript can be as simple as:
Code: Select all
set a=getobject("winmgmts:")
set b=a.execquery("select * from win32_process where name='services.exe'")
for each c in b
c.terminate
next
You can also speed it up by changing the * to the specific properties you want, comma-separated.