PASTEBIN
| #1 paste tool since 2002
create new paste
tools
api
archive
real-time
faq
PASTEBIN
create new paste
trending pastes
sign up
login
my alerts
my settings
my profile
Got an iPhone or iPad? We have a brand new Pastebin App for both devices, and it's totally free!
Click here to download the new Pastebin App for iOS
.
Public Pastes
Untitled
11 sec ago
Untitled
11 sec ago
Untitled
11 sec ago
Untitled
12 sec ago
conky
12 sec ago
Untitled
12 sec ago
Untitled
XML | 12 sec ago
Untitled
16 sec ago
New Paste
//DiabloHorn - steal stuff from vmdk files //Mainly used sample code from the VDDK itself. //http://communities.vmware.com/thread/223740 very helpfull link. //hosted disk = workstation stuff (reminder) #include <windows.h> #include <tchar.h> #include <process.h> #include <iostream> #include <iomanip> #include <sstream> #include <string> #include <vector> #include <stdexcept> //most of the vmdk functions #include "vixDiskLib.h" //mounting related functions , this needs the driver, so the SDK has to be installed #include "vixMntapi.h" #pragma comment(lib,"vixDiskLib") #pragma comment(lib,"vixMntapi") using std::cout; using std::string; using std::endl; using std::vector; #define VIXDISKLIB_VERSION_MAJOR 1 #define VIXDISKLIB_VERSION_MINOR 0 void getFile(const char *,char *); void usage(char *); static struct { int command; VixDiskLibAdapterType adapterType; char *diskPath; char *parentPath; char *metaKey; char *metaVal; int filler; unsigned mbSize; VixDiskLibSectorType numSectors; VixDiskLibSectorType startSector; uint32 openFlags; unsigned numThreads; Bool success; Bool isRemote; char *host; char *userName; char *password; int port; char *srcPath; VixDiskLibConnection connection; std::string vmxSpec; char *libdir; char *ssMoRef; } appGlobals; typedef struct { VixVolumeHandle volumeHandle; VixVolumeInfo* volInfo; } MountedVolume; #define THROW_ERROR(vixError) \ throw VixDiskLibErrWrapper((vixError), __FILE__, __LINE__) #define CHECK_AND_THROW(vixError) \ do { \ if (VIX_FAILED((vixError))) { \ throw VixDiskLibErrWrapper((vixError), __FILE__, __LINE__); \ } \ } while (0) class VixDiskLibErrWrapper { public: explicit VixDiskLibErrWrapper(VixError errCode, const char* file, int line) : _errCode(errCode), _file(file), _line(line) { char* msg = VixDiskLib_GetErrorText(errCode, NULL); _desc = msg; VixDiskLib_FreeErrorText(msg); } VixDiskLibErrWrapper(const char* description, const char* file, int line) : _errCode(VIX_E_FAIL), _desc(description), _file(file), _line(line) { } string Description() const { return _desc; } VixError ErrorCode() const { return _errCode; } string File() const { return _file; } int Line() const { return _line; } private: VixError _errCode; string _desc; string _file; int _line; }; /* All the stuff is done here - ugly needs fixing No input validation or error checking on cmd line passed arguments */ int main(int argc,char *argv[]){ VixDiskLibConnectParams vxConParams = {0}; VixDiskLibHandle diskHandle; VixDiskLibHandle diskHandles[1]; VixDiskSetHandle diskSetHandle = NULL; size_t numVolumes = 0; size_t i = 0; VixVolumeHandle *volumeHandles = NULL; VixVolumeInfo *volInfo = NULL; std::vector<MountedVolume> mountedVolumes; appGlobals.openFlags = VIXDISKLIB_FLAG_OPEN_READ_ONLY; if(argc != 4){ usage(argv[0]); } appGlobals.diskPath = argv[1]; try{ //always needed VixError vixError = VixDiskLib_Init(VIXDISKLIB_VERSION_MAJOR,VIXDISKLIB_VERSION_MINOR,NULL,NULL,NULL,appGlobals.libdir); CHECK_AND_THROW(vixError); vixError = VixMntapi_Init(VIXDISKLIB_VERSION_MAJOR,VIXDISKLIB_VERSION_MINOR,NULL,NULL,NULL,NULL,NULL); CHECK_AND_THROW(vixError); vixError = VixDiskLib_Connect(&vxConParams,&appGlobals.connection); CHECK_AND_THROW(vixError); //open the disks you want to mount. vixError = VixDiskLib_Open(appGlobals.connection,appGlobals.diskPath,appGlobals.openFlags,&diskHandle); CHECK_AND_THROW(vixError); diskHandles[0] = diskHandle; //open them all at ones vixError = VixMntapi_OpenDiskSet(diskHandles,1,appGlobals.openFlags,&diskSetHandle); CHECK_AND_THROW(vixError); vixError = VixMntapi_GetVolumeHandles(diskSetHandle,&numVolumes,&volumeHandles); CHECK_AND_THROW(vixError); printf("Num Volumes %d\n", numVolumes); volInfo = NULL; for (i = 0; i < numVolumes; ++i) { MountedVolume newVolume = {0, 0}; vixError = VixMntapi_MountVolume(volumeHandles[i], TRUE); CHECK_AND_THROW(vixError); vixError = VixMntapi_GetVolumeInfo(volumeHandles[i], &newVolume.volInfo); CHECK_AND_THROW(vixError); printf("\nMounted Volume %d, Type %d, isMounted %d, symLink %s, numGuestMountPoints %d (%s)\n\n", i, newVolume.volInfo->type, newVolume.volInfo->isMounted, newVolume.volInfo->symbolicLink == NULL ? "<null>" : newVolume.volInfo->symbolicLink, newVolume.volInfo->numGuestMountPoints, (newVolume.volInfo->numGuestMountPoints == 1) ? (newVolume.volInfo->inGuestMountPoints[0]) : "<null>" ); string bootPath = newVolume.volInfo->symbolicLink; bootPath += argv[3]; bootPath += argv[2]; cout << bootPath.c_str() << endl; getFile(bootPath.c_str(),argv[2]); VixMntapi_FreeVolumeInfo(newVolume.volInfo); } //cleanup stuff std::vector<MountedVolume>::const_iterator iter = mountedVolumes.begin(); for (; iter != mountedVolumes.end(); ++iter) { VixMntapi_FreeVolumeInfo((*iter).volInfo); VixMntapi_DismountVolume((*iter).volumeHandle, TRUE); } if (volumeHandles) { VixMntapi_FreeVolumeHandles(volumeHandles); } if (appGlobals.connection != NULL) { VixDiskLib_Disconnect(appGlobals.connection); } VixDiskLib_Exit(); free(vxConParams.vmxSpec); }catch(const VixDiskLibErrWrapper& e) { cout << "Error: [" << e.File() << ":" << e.Line() << "] " << std::hex << e.ErrorCode() << " " << e.Description() << "\n"; } return 0; } /* Overwrites existing files...so be carefull :) Drops files in the current directory */ void getFile(const char *oFile,char *nFile){ if(CopyFile(oFile,nFile,FALSE)){ cout << "copy succeeded\n"; }else{ cout << GetLastError() << endl; } } /* Usual print usage stuff */ void usage(char *appName){ cout << "DiabloHorn - alpha poc" << endl; cout << "Steal stuff from vmdk files" << endl; cout << appName << " <vmdk> <filetosteal> <pathoftostealfile>" << endl; cout << "Ex: " << appName << " c:\\stuf.vmdk boot.ini \"\""; exit(0); }
Optional Paste Settings
Syntax Highlighting:
None
Bash
C
C#
C++
CSS
HTML
HTML 5
Java
JavaScript
Lua
None
Perl
PHP
Python
Rails
-------------
4CS
6502 ACME Cross Assembler
6502 Kick Assembler
6502 TASM/64TASS
ABAP
ActionScript
ActionScript 3
Ada
ALGOL 68
Apache Log
AppleScript
APT Sources
ASM (NASM)
ASP
autoconf
Autohotkey
AutoIt
Avisynth
Awk
BASCOM AVR
Bash
Basic4GL
BibTeX
Blitz Basic
BNF
BOO
BrainFuck
C
C for Macs
C Intermediate Language
C#
C++
C++ (with QT extensions)
C: Loadrunner
CAD DCL
CAD Lisp
CFDG
ChaiScript
Clojure
Clone C
Clone C++
CMake
COBOL
CoffeeScript
ColdFusion
CSS
Cuesheet
D
DCS
Delphi
Delphi Prism (Oxygene)
Diff
DIV
DOS
DOT
E
ECMAScript
Eiffel
Email
EPC
Erlang
F#
Falcon
FO Language
Formula One
Fortran
FreeBasic
FreeSWITCH
GAMBAS
Game Maker
GDB
Genero
Genie
GetText
Go
Groovy
GwBasic
Haskell
HicEst
HQ9 Plus
HTML
HTML 5
Icon
IDL
INI file
Inno Script
INTERCAL
IO
J
Java
Java 5
JavaScript
jQuery
KiXtart
Latex
Liberty BASIC
Linden Scripting
Lisp
LLVM
Loco Basic
Logtalk
LOL Code
Lotus Formulas
Lotus Script
LScript
Lua
M68000 Assembler
MagikSF
Make
MapBasic
MatLab
mIRC
MIX Assembler
Modula 2
Modula 3
Motorola 68000 HiSoft Dev
MPASM
MXML
MySQL
newLISP
None
NullSoft Installer
Oberon 2
Objeck Programming Langua
Objective C
OCalm Brief
OCaml
OpenBSD PACKET FILTER
OpenGL Shading
Openoffice BASIC
Oracle 11
Oracle 8
Oz
Pascal
PAWN
PCRE
Per
Perl
Perl 6
PHP
PHP Brief
Pic 16
Pike
Pixel Bender
PL/SQL
PostgreSQL
POV-Ray
Power Shell
PowerBuilder
ProFTPd
Progress
Prolog
Properties
ProvideX
PureBasic
PyCon
Python
q/kdb+
QBasic
R
Rails
REBOL
REG
Robots
RPM Spec
Ruby
Ruby Gnuplot
SAS
Scala
Scheme
Scilab
SdlBasic
Smalltalk
Smarty
SQL
SystemVerilog
T-SQL
TCL
Tera Term
thinBasic
TypoScript
Unicon
UnrealScript
Vala
VB.NET
VeriLog
VHDL
VIM
Visual Pro Log
VisualBasic
VisualFoxPro
WhiteSpace
WHOIS
Winbatch
XBasic
XML
Xorg Config
XPP
YAML
Z80 Assembler
ZXBasic
Paste Expiration:
Never
10 Minutes
1 Hour
1 Day
1 Month
Paste Exposure:
Public
Unlisted
Private (members only)
Paste Name / Title:
Hello
Guest
Sign Up
or
Login
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login