Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Lenoch

Pages: [1] 2
1
C - C++ / [C++] making some screenshots with gdiplus
« on: December 12, 2015, 04:21:13 pm »
Hello you guys. I'm working a bit on improving my C++ so I decided to mess around with screenshots. it's windows based an uses gdiplus and windows api. It gets your window with the windows api then handles the bitmap that it generates with gdiplus and saves it to a file.

The screenshot header file
Code: [Select]
#include <Windows.h>
#include <gdiplus.h>


#pragma comment(lib, "gdiplus.lib")
#pragma once

class Screenshot
{
public:
    Screenshot();
    ~Screenshot();
    void makeScreenshot(const WCHAR*);
private:
    ULONG_PTR token;
    int GetEncoderClsid(const WCHAR*, CLSID*);
};

The screenshot class

Code: [Select]
#include "Screenshot.h"

ULONG_PTR gdiToken;

Screenshot::Screenshot()
{
    Gdiplus::GdiplusStartupInput StartupInput;
    Gdiplus::GdiplusStartup(&gdiToken, &StartupInput, NULL);
}


Screenshot::~Screenshot()
{
    Gdiplus::GdiplusShutdown(gdiToken);
}

int Screenshot::GetEncoderClsid(const WCHAR* format, CLSID* pClsid) {
    UINT num = 0;
    UINT size = 0;

    Gdiplus::ImageCodecInfo* pImageCodecInfo = NULL;
    Gdiplus::GetImageEncodersSize(&num, &size);
   
    if (size == 0)
        return -1;

    pImageCodecInfo = (Gdiplus::ImageCodecInfo*)(malloc(size));

    if (pImageCodecInfo == NULL)
        return -1;

    Gdiplus::GetImageEncoders(num, size, pImageCodecInfo);

    for (UINT codec = 0; codec < num; ++codec)
    {
        if (wcscmp(pImageCodecInfo[codec].MimeType, format) == 0)
        {
            *pClsid = pImageCodecInfo[codec].Clsid;
            free(pImageCodecInfo);
            return codec;
        }
    }

    free(pImageCodecInfo);
    return -1;
}

void Screenshot::makeScreenshot(const WCHAR* filename) {
    int screenHeight = GetSystemMetrics(SM_CYSCREEN);
    int screenWidth = GetSystemMetrics(SM_CXSCREEN);

    HWND desktopWindow = GetDesktopWindow();

    HDC desktopDC = GetDC(desktopWindow);
    HDC captureDC = CreateCompatibleDC(desktopDC);

    HBITMAP captureBitmap = CreateCompatibleBitmap(desktopDC, screenWidth, screenHeight);
    SelectObject(captureDC, captureBitmap);
    BitBlt(captureDC, 0, 0, screenWidth, screenHeight, desktopDC, 0, 0, SRCCOPY | CAPTUREBLT);

    Gdiplus::Bitmap *bitmap = new Gdiplus::Bitmap(captureBitmap, NULL);
    CLSID clsId;

    int retVal = this->GetEncoderClsid(L"image/png", &clsId);
    bitmap->Save(filename, &clsId, NULL);
   
    ReleaseDC(desktopWindow, desktopDC);
    DeleteDC(captureDC);
    DeleteObject(captureBitmap);
}

2
General discussion / Re: Lets talk about names?
« on: December 04, 2015, 07:36:36 am »
Well I had to decide in a rush what name to pick here. So I tought lenin was a cool name but then I thought that was just plain stupid. So I dropped the "in" in the name and added stuff that sounded nice. eventually "och" won and now i'm lenoch.

Also a fun fact I realized months later the word means 'lazy bastard' in czech. Now that was unexpected

3
Projects and Discussion / Re: Multi-tenant db versus single-tenant db
« on: November 24, 2015, 12:00:15 pm »
Can't you use views? Although that might get you some performance problems.

4
Found it on the Webs / Re: Hacker scripts
« on: November 23, 2015, 03:42:31 pm »
Lol this is like thewormkill in the future :D "You know, that type of a guy who loves Vim, creates diagrams in Dot and writes wiki-posts in Markdown..."

5
C - C++ / Re: What to use?
« on: November 14, 2015, 02:16:55 am »
I'm just helping. I mean you have been busy with this specific task for 3 month's if not more.

6
C - C++ / Re: What to use?
« on: November 14, 2015, 12:30:26 am »
There is an installer for codeblocks with gcc bundled that does all the shit for you. If you fail you might need to reevaluate your life decisions

7
General discussion / Re: Social Engineering is a Powerful Tool
« on: November 11, 2015, 05:49:03 pm »
Yes it's indeed more secure to have your forum password the same as your IRC password :)

8
Game Hacking, Modding & Discussing / Re: Game from your childhood
« on: October 20, 2015, 07:32:11 am »
C&C: Red Alert I
C&C: Tiberian Sun
Dune 2000

some stuff I don't remember because all I mostly played was those. Yes I was a C&C freak.



9
I have a first working version of the urban dictionary module here: https://github.com/Lenoch420/ud
The code needs cleanup work and depending on what people want some added functionality, for now it just works

I also just had the idea in mind for a minimum install script in bash which just pulls modules from git, compiles them and moves them to the scripts/ directory.

10
you can use hexchat, telnet, weechat, quassel, pidgin, empathy, .... all opensource stuff and free

11
General discussion / Re: HAPPY BIRTHDAY PHAGE
« on: September 19, 2015, 03:27:00 am »
I did not join for practical reasons and to cope with it I went to another party but it sucked. It sucked so hard I just wanted to take the plane but well there was no plane anymore :(


And happy birthday phage you get those multiple women in your bed and have a sexy awesome party

13
Beginner's Corner / Re: java search database
« on: September 02, 2015, 12:07:42 am »
Just check the link I posted. It explains how to execute a statement. It's just nothing more then defining an object and executing a method.

14
Beginner's Corner / Re: java search database
« on: September 01, 2015, 06:26:53 pm »
Hmm so no java code. Have you tried looking up on google?


I found this: https://www.youtube.com/watch?v=2i4t-SL1VsU
and this: https://docs.oracle.com/javase/tutorial/jdbc/index.html




15
Beginner's Corner / Re: the right way to learn websites hacking
« on: September 01, 2015, 06:17:11 pm »
As a beginner you should better not touch Laravel right away. Especially if you want to learn it in while learning to find vulnerabilities. Laravel abstracts PHP too much. All the code that sanitizes your data is hidden in Eloquent or the Authentication Module and you will never be in contact with Security except maybe the encryption methods to store passwords

I recommend you start with simple one file scripts. try to look what happens when you don't use htmlspecialchars() on user inputted code. (Tip: try <script>alert("hello");</script>) and understand the dangers. And learn what goes wrong in the code for all other type of security flaws.

When you are confident in basic PHP and want to write a Web application, Go for Laravel. I use it myself and I think it's an awesome framework.

Pages: [1] 2