Data hiding

Any feature you'd like to see in Ultr@VNC? Just propose it here.

Data hiding

Postby Dhanush » 2014-04-16 06:38

I want data hiding to be apart of UltraVNC i.e. when the remote client is connected to the server some of the priviliged information on the server(for example details about a person should be blurred) should not be visible to the client.
Is there an API to acheive this? If not, What are the other alternatives?
Dhanush
8
8
 
Posts: 12
Joined: 2014-04-16 05:22

Re: Data hiding

Postby Bonji » 2014-04-17 14:34

How would the viewer have any idea what should or should not be visible? No VNC solution can do this as far as I'm aware.
-Ben
Bonji
100
100
 
Posts: 325
Joined: 2008-05-13 14:54

Re: Data hiding

Postby Dhanush » 2014-04-23 10:24

when the server copies the screen interms of small rectangles into the buffers to send to the client/viewer, it should be able to get the co-ordiantes of the textfields and blurr its content. Now the blurred content should be visible at the client side.
Dhanush
8
8
 
Posts: 12
Joined: 2014-04-16 05:22

Re: Data hiding

Postby Bonji » 2014-04-28 20:47

VNC has no idea what the contents of the screen updates actually are. It's just "painting" the remote screen for the local client.

Someone correct me if I'm wrong, but I'm pretty sure I'm not.
-Ben
Bonji
100
100
 
Posts: 325
Joined: 2008-05-13 14:54

Re: Data hiding

Postby Rudi De Vos » 2014-04-29 08:38

From vnc point, you send bitmaps, no application data.

This would require a lot of code...yes you could write some code that based on some user input detect the edit fields.
But then this would break the copyrects ( move a window, as this isn't handled with bitmaps)
This is nothing we gonna do, not general enough to spend time on it.
Rudi De Vos
Admin & Developer
Admin & Developer
 
Posts: 5933
Joined: 2004-04-23 10:21

Re: Data hiding

Postby Dhanush » 2014-06-03 11:20

thanks for the replies! Now I am in the last step of what I want to acheive. All I need is to get the bitmap of the screen at the winvnc.sln file.
Since the uVNC server creates a bitmap of the server screen, I need to know where in winvnc.sln will I get hold of the bitmap object?
Dhanush
8
8
 
Posts: 12
Joined: 2014-04-16 05:22

Re: Data hiding

Postby Rudi De Vos » 2014-06-03 15:43

Look for m_backbuffer

Screen -> this is copied to Thebuffer ( memorybuffer desktop)
Thebuffer -> is copied to m_backbuffer ( memorybuffer send to the viewer)

As starting point you can use the function that write a red rectangle on the viewer to warn for UAC.
void
vncDesktop::WriteMessageOnScreen(char * tt,BYTE *scrBuff, UINT scrBuffSize)

Instead of overwriting the rectangle you can use some blur function to manipulate the old pixels.
Rudi De Vos
Admin & Developer
Admin & Developer
 
Posts: 5933
Joined: 2004-04-23 10:21

Re: Data hiding

Postby Dhanush » 2014-06-04 05:50

This is the scene now, I have created a bitmap of the screen with the data blurred using an external applicaiton,which I have created. Now all I want to do is "AND" (bit multiplication) this bitmap with the original bitmap created by the uVNC server. After the bits are multiplied, the bitmap is sent to the viewer by the server which is then displayed at the viewer.
For doing the bit multiplication I have to find the bitmap created at the uVNC server.
Dhanush
8
8
 
Posts: 12
Joined: 2014-04-16 05:22

Re: Data hiding

Postby Rudi De Vos » 2014-06-04 08:17

You makes it harder this it should be.

You have a buffer of the full screen m_backbuffer ( Width/Height/stride (sizeof a line)/pixels size(8-32bit) is known)
[pixel1,pixel2,...] row1
[pixel1,pixel2,...] row2
You need to extract a rect ( x,y,w,h) in a temp buffer, does your math and put the temp buffer back.
That's all.... the hardest is to know the correct rect that need to be blured.
Rudi De Vos
Admin & Developer
Admin & Developer
 
Posts: 5933
Joined: 2004-04-23 10:21

Re: Data hiding

Postby Dhanush » 2014-06-11 04:45

Is there an API from which I can convert the m_backbuff to a bitmap file? so that I can view what exactly m_backbuff holds at a particular point of time.
Also what are m_ScaledBuff and m_mainbuff used for?
Dhanush
8
8
 
Posts: 12
Joined: 2014-04-16 05:22

Re: Data hiding

Postby Rudi De Vos » 2014-06-11 09:06

m_mainbuff= copy of server screen
m_ScaledBuff= copy of server screen, but scaled when server site scaling is used

m_backbuffer= You do exact the same as the viewer do on his screen in this local buffer. The buffer is a copy of the
viewer screen. VNC compare m_mainbuff with this buffer to check for changes


The format of the buffer is a DIB
see
http://msdn.microsoft.com/en-us/library ... 94(v=vs.85).aspx

There are functions to convert DIB to bitmaps.
Rudi De Vos
Admin & Developer
Admin & Developer
 
Posts: 5933
Joined: 2004-04-23 10:21

Re: Data hiding

Postby Dhanush » 2014-06-20 06:59

In which part of the source code is the the bitmap buffer(having the server screen) sent back to the viewer?
Dhanush
8
8
 
Posts: 12
Joined: 2014-04-16 05:22

Re: Data hiding

Postby Rudi De Vos » 2014-06-21 21:01

The bitmap himself is never send, we only send difference

Sample
change rects ( 0,0,50,50),(100,150,60,800),(x,y,w,h)
vncclient.cpp:vncClient::SendRectangles(const rfb::RectVector &rects)
Each rect is send seperate
vncClient::SendRectangle(const rfb::Rect &rect)
Data is also encoded and some encoders send data insite the encoder ( like zrle)
Rudi De Vos
Admin & Developer
Admin & Developer
 
Posts: 5933
Joined: 2004-04-23 10:21

Re: Data hiding

Postby Dhanush » 2014-06-26 10:08

Since the m_mainbuff has the copy of the server screen, I want to mask(merge) the copy of the the server screen with a bitmap stored on the disk.
In which part of the source code can I perform this action? i.e since there are several references to m_mainbuff where do I get hold of the copy of the server screen?
Dhanush
8
8
 
Posts: 12
Joined: 2014-04-16 05:22

Re: Data hiding

Postby Rudi De Vos » 2014-06-26 17:20

The m_mainbuff is a representaion of the screen, or the framebuffer in case you use the driver.
In both cases the buffer is updated several times a second.
If you would write your data to it, it would be overwritten a few ms later.
Rudi De Vos
Admin & Developer
Admin & Developer
 
Posts: 5933
Joined: 2004-04-23 10:21

Re: Data hiding

Postby Dhanush » 2014-06-27 05:44

In which part of the code is the difference taken(between m_mainbuf and m_backbuff) ? so that I can mask the contents of m_mainbuf and the bitmap stored on the disk.
Dhanush
8
8
 
Posts: 12
Joined: 2014-04-16 05:22

Re: Data hiding

Postby Rudi De Vos » 2014-06-27 07:21

Now we back on start

first of my answers was
Look for m_backbuffer

Screen -> this is copied to Thebuffer ( memorybuffer desktop)
Thebuffer -> is copied to m_backbuffer ( memorybuffer send to the viewer)

As starting point you can use the function that write a red rectangle on the viewer to warn for UAC.
void
vncDesktop::WriteMessageOnScreen(char * tt,BYTE *scrBuff, UINT scrBuffSize)


This function write a bitmap to the buffer and send it to the client....this is exact what you want to do.
Rudi De Vos
Admin & Developer
Admin & Developer
 
Posts: 5933
Joined: 2004-04-23 10:21

Re: Data hiding

Postby Dhanush » 2014-06-30 06:54

Yeah, thats exactly what I want to do.
So I have to replace the m_membitmap with the bitmap I want to load right?

******************************************************************************
vncDesktop::WriteMessageOnScreen(char * tt,BYTE *scrBuff, UINT scrBuffSize)
{
// Select the memory bitmap into the memory DC
RECT rect;
SetRect(&rect, 0,0, 300, 120);
COLORREF bgcol =RGB(0xff, 0x00, 0x00); //bazingaa
COLORREF oldtxtcol =SetTextColor(m_hmemdc, RGB(0,0,254)); //bazingaa
COLORREF oldbgcol =SetBkColor( m_hmemdc, bgcol);
HBRUSH backgroundBrush = CreateSolidBrush(bgcol);

HANDLE handleImage;

handleImage = LoadImage(0,"C:\\Users\\310154757\\Documents\\Visual Studio 2010\\Projects\\bitmap\\bitmap\\screen.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);

HBITMAP oldbitmap;
if ((oldbitmap = (HBITMAP) SelectObject(m_hmemdc, handleImage)) == NULL)
return;


FillRect(m_hmemdc, &rect, backgroundBrush);
DrawText(m_hmemdc,tt,strlen(tt),&rect,DT_CENTER | DT_VCENTER);
// Select the old bitmap back into the memory DC
//DWORD err= GetLastError();


//ExtTextOut(m_hmemdc, 0, 0, ETO_OPAQUE,&rect,tt,strlen(tt), NULL);


SetBkColor( m_hmemdc, oldbgcol);

SetTextColor(m_hmemdc, oldtxtcol);
SelectObject(m_hmemdc, oldbitmap);
DeleteObject(backgroundBrush);

CopyToBuffer(rect, scrBuff, scrBuffSize);
}
*************************************************************************

doesnt seem to work. I guess its not being written to the buffer which is sent to the viewer.
How do I write it to the buffer?
Dhanush
8
8
 
Posts: 12
Joined: 2014-04-16 05:22

Re: Data hiding

Postby Dhanush » 2014-07-01 06:42

the control while debugging never enters the function - void vncDesktop::WriteMessageOnScreen(char * tt,BYTE *scrBuff, UINT scrBuffSize)
so making changes there is not helping.
Dhanush
8
8
 
Posts: 12
Joined: 2014-04-16 05:22

Re: Data hiding

Postby Dhanush » 2014-07-01 06:58

I am able to mask my bitmap with the contents of the "databuf" buffer and view the output in an image file saved on a disk. but the problem is databuf contents are not being sent to the viewer.
Dhanush
8
8
 
Posts: 12
Joined: 2014-04-16 05:22

Re: Data hiding

Postby Rudi De Vos » 2014-07-01 13:35

WriteMessageOnScreen function is used
winvnc.exe running as application
You open a window that require UAC, while the UAC popup is shown, the viewer show a message "the the remote need to press the UAC"
This is done with this function

Search for WriteMessageOnScreen in the src and find the spot(s) where it is called.
For testing just remove the the if so WriteMessageOnScreen is called even without the UAC case.
Rudi De Vos
Admin & Developer
Admin & Developer
 
Posts: 5933
Joined: 2004-04-23 10:21

Re: Data hiding

Postby Dhanush » 2014-07-02 11:30

below is the WriteMessageOnScreen(char * tt,BYTE *scrBuff, UINT scrBuffSize) function.
I dont see it writing to the UAC anywhere. Please help!

*********************************************************************************************
void vncDesktop::WriteMessageOnScreen(char * tt,BYTE *scrBuff, UINT scrBuffSize)
{
// Select the memory bitmap into the memory DC
RECT rect;
SetRect(&rect, 0,0, 300, 120);
COLORREF bgcol =RGB(0xff, 0x00, 0x00); //bazingaa
COLORREF oldtxtcol =SetTextColor(m_hmemdc, RGB(0,0,254)); //bazingaa
COLORREF oldbgcol =SetBkColor( m_hmemdc, bgcol);
HBRUSH backgroundBrush = CreateSolidBrush(bgcol);

HBITMAP oldbitmap;
if ((oldbitmap = (HBITMAP) SelectObject(m_hmemdc, m_membitmap)) == NULL)
return;

FillRect(m_hmemdc, &rect, backgroundBrush);
DrawText(m_hmemdc,tt,strlen(tt),&rect,DT_CENTER | DT_VCENTER);
// Select the old bitmap back into the memory DC
//DWORD err= GetLastError();
//ExtTextOut(m_hmemdc, 0, 0, ETO_OPAQUE,&rect,tt,strlen(tt), NULL);


SetBkColor( m_hmemdc, oldbgcol);

SetTextColor(m_hmemdc, oldtxtcol);
SelectObject(m_hmemdc, oldbitmap);
DeleteObject(backgroundBrush);

CopyToBuffer(rect, scrBuff, scrBuffSize);
}
************************************************************
Dhanush
8
8
 
Posts: 12
Joined: 2014-04-16 05:22

Re: Data hiding

Postby Rudi De Vos » 2014-07-02 19:00

Search for WriteMessageOnScreen and find the spot(s) where it is called.


vncdesktopthread.cpp
Code: Select all
if (vncService::InputDesktopSelected()==2)
   {
      m_desktop->m_buffer.WriteMessageOnScreen("UltraVVNC running as application doesn't \nhave permission to acces \nUAC protected windows.\n\nScreen is locked until the remote user \nunlock this window");
      rfb::Rect rect;
      rect.tl = rfb::Point(0,0);
      rect.br = rfb::Point(300,120);
      rgncache.assign_union(rect);


We change screendata by writing text on it and tell vnc that the spot is changed

For testing just remove the the if


Make sure
Code: Select all
m_desktop->m_buffer.WriteMessageOnScreen("UltraVVNC running as application doesn't \nhave permission to acces \nUAC protected windows.\n\nScreen is locked until the remote user \nunlock this window");
      rfb::Rect rect;
      rect.tl = rfb::Point(0,0);
      rect.br = rfb::Point(300,120);
      rgncache.assign_union(rect);

is called each run, place it before
Code: Select all
if (vncService::InputDesktopSelected()==2)

so it look like this
Code: Select all
      //screensize_changed=true;
   }
m_desktop->m_buffer.WriteMessageOnScreen("UltraVVNC running as application doesn't \nhave permission to acces \nUAC protected windows.\n\nScreen is locked until the remote user \nunlock this window");
      rfb::Rect rect;
      rect.tl = rfb::Point(0,0);
      rect.br = rfb::Point(300,120);
      rgncache.assign_union(rect);      
   if (vncService::InputDesktopSelected()==2)
   {
           if (m_desktop->startw8)
            {


Now you should see what you do on screen
Rudi De Vos
Admin & Developer
Admin & Developer
 
Posts: 5933
Joined: 2004-04-23 10:21


Return to Feature requests

Who is online

Users browsing this forum: No registered users and 3 guests