Apr 8, 2015 09:27 PM
(This post was last modified: Apr 8, 2015 09:29 PM by debug.)
Hey all,
Working on my crypter I encountered a problem. The NSTheme does not have an option to scroll to the bottom of the listview. So, I created a pretty ghetto way to do it.
It works by getting a corner of the form(top left in my case, can be changed), and adding values to the x and y to point the cursor to the correct starting point. Then clicks down, does the same process again to go to the bottom point, then releases mouse.
Visual Basic(Used a converter: may be errors)
API:
PHP Code
<?php <DllImport("user32.dll", CharSet := CharSet.Auto)> _ Public Shared Function FindWindow(strClassName As String, strWindowName As String) As IntPtr End Function
<DllImport("user32.dll")> _ Public Shared Function GetWindowRect(hwnd As IntPtr, ByRef rectangle As Rect) As Boolean End Function
Public Structure Rect Public Property Left() As Integer Get Return m_Left End Get Set m_Left = Value End Set End Property Private m_Left As Integer Public Property Top() As Integer Get Return m_Top End Get Set m_Top = Value End Set End Property Private m_Top As Integer Public Property Right() As Integer Get Return m_Right End Get Set m_Right = Value End Set End Property Private m_Right As Integer Public Property Bottom() As Integer Get Return m_Bottom End Get Set m_Bottom = Value End Set End Property Private m_Bottom As Integer End Structure
<DllImport("user32.dll", CallingConvention := CallingConvention.StdCall)> _ Private Shared Sub mouse_event(flags As MouseEventFlags, dx As UInteger, dy As UInteger, delta As UInteger, extraInfo As IntPtr) End Sub
<Flags> _ Private Enum MouseEventFlags As UInteger LeftDown = &H2 LeftUp = &H4 End Enum
Public Sub LeftMouseDown() mouse_event(MouseEventFlags.LeftDown, 0, 0, 0, IntPtr.Zero) End Sub
Public Sub LeftMouseUp() mouse_event(MouseEventFlags.LeftUp, 0, 0, 0, IntPtr.Zero) End Sub
Main:
PHP Code
<?php Dim ptr As IntPtr = Process.GetCurrentProcess().MainWindowHandle Dim rec As New Rect() GetWindowRect(ptr, rec) Dim original As Point = Cursor.Position Dim top As New Point(rec.Right - 40, rec.Top + 140) 'position of scroll bar at top. Change numerical values
Dim bot As New Point(rec.Right - 40, rec.Top + 330) 'position of scroll bar at botom. Change numerical values
Cursor.Hide() Cursor.Position = top
LeftMouseDown() Thread.Sleep(10) Cursor.Position = bot LeftMouseUp() Cursor.Position = original Cursor.Show()
C#
API:
PHP Code
<?php [DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern IntPtr FindWindow(string strClassName, string strWindowName);
[DllImport("user32.dll")] public static extern bool GetWindowRect(IntPtr hwnd, ref Rect rectangle);
public struct Rect { public int Left { get; set; } public int Top { get; set; } public int Right { get; set; } public int Bottom { get; set; } } [DllImport("user32.dll", CallingConvention = CallingConvention.StdCall)] static extern void mouse_event(MouseEventFlags flags, uint dx, uint dy, uint delta, IntPtr extraInfo);
[Flags] enum MouseEventFlags : uint { LeftDown = 0x0002, LeftUp = 0x0004, }
public void LeftMouseDown() { mouse_event(MouseEventFlags.LeftDown, 0, 0, 0, IntPtr.Zero); }
public void LeftMouseUp() { mouse_event(MouseEventFlags.LeftUp, 0, 0, 0, IntPtr.Zero); }
Main:
PHP Code
<?php IntPtr ptr = Process.GetCurrentProcess().MainWindowHandle; Rect rec = new Rect(); GetWindowRect(ptr, ref rec); Point original = Cursor.Position; Point top = new Point(rec.Right - 40, rec.Top + 140); //position of scroll bar at top. Change numerical values Point bot = new Point(rec.Right - 40, rec.Top + 330);//position of scroll bar at botom. Change numerical values Cursor.Hide(); Cursor.Position = top;
LeftMouseDown(); Thread.Sleep(10); Cursor.Position = bot; LeftMouseUp(); Cursor.Position = original; Cursor.Show();
Quick example of how it looks in my crypter:
This can be applied for other controls as well with a little tweaking. Hope this is useful to others.
Enjoy
-debug
That has to be the worse way I can think of to auto scroll.
DO NOT DEAL WITH THIS MEMBER
Apr 9, 2015 06:59 AM
(This post was last modified: Apr 9, 2015 06:59 AM by Ninja.)
I believe most controls with a scrollbutton have a scrolltoview function where you can scroll to the last item. But good job nonetheless.
EDIT: Yep:
http://www.csharp-examples.net/autoscroll/
(Apr 9, 2015 03:59 AM)Cornflower Blue இڿڰۣ-ڰۣ— Wrote: That has to be the worse way I can think of to auto scroll.
True. True true true. As true as 1+1=2
Assert failure(PID 10704 [0x000029d0], Thread: 10960 [0x2ad0]): pBuffer != NULL
DO NOT DEAL WITH THIS MEMBER
wait, i have never seen that code before so i may be wrong here but the standard listview has an insert option.
Code ListView1.Items.Insert(0, New ListViewItem With {.Text = cur})
why not insert your text at the first position?
The problem is that the theme does not have these standard scroll functions, or anything that would allow me to auto scroll. So I didn't feel like figuring out how to code those functions, so I wrote this way.
(Apr 9, 2015 09:20 AM)debug Wrote: The problem is that the theme does not have these standard scroll functions, or anything that would allow me to auto scroll. So I didn't feel like figuring out how to code those functions, so I wrote this way.
I'm sorry, but you didn't feel like going in, seeing how the class handled scrolling, find the "OnMouseWheel" event at the bottom of the class, and see it reference a "VS" variable of "NSVScrollBar" type, or the fact that you could simplify your code down to
Code public void ScrollToEnd()
{
VS.Value = VS.Maximum;
}
inside the ListView class and be done with it?
Yet you coded a crypter, which will require a lot more dedication and effort to make sure it remains FUD, and works with multiple RATs, Keyloggers, and other malware being sold on here AND other websites.
(Apr 9, 2015 09:34 AM)Nikey646 Wrote: I'm sorry, but you didn't feel like going in, seeing how the class handled scrolling, find the "OnMouseWheel" event at the bottom of the class, and see it reference a "VS" variable of "NSVScrollBar" type, or the fact that you could simplify your code down to
Code public void ScrollToEnd()
{
VS.Value = VS.Maximum;
}
inside the ListView class and be done with it?
Yet you coded a crypter, which will require a lot more dedication and effort to make sure it remains FUD, and works with multiple RATs, Keyloggers, and other malware being sold on here AND other websites. Yeah you're right. But I had an idea that I wanted to try so I did.
Apr 9, 2015 04:26 PM
(This post was last modified: Apr 9, 2015 04:28 PM by Tedd.)
(Apr 9, 2015 09:59 AM)debug Wrote: Yeah you're right. But I had an idea that I wanted to try so I did.
>had an idea that i wanted to try
(Apr 9, 2015 09:20 AM)debug Wrote: The problem is that the theme does not have these standard scroll functions, or anything that would allow me to auto scroll. So I didn't feel like figuring out how to code those functions, so I wrote this way.
>didn't feel like figuring out how to code those functions
Something doesn't add up.. Even if it was an idea, don't release it as a solution when it's literally the worst way to handle something.
That's like saying "hm, i'm not sure how to get to the movie theater, so instead of using a map i'm going to get someone to steer my car while i drive to get there, instead of just looking up the address of the theater and putting it in my gps.."
Sure, it works, but it's not a "solution" by any means and I don't think it should be shared as one. ESPECIALLY if you are trying to sell a crypter as "coded from scratch" (calling bs)
Apr 9, 2015 04:59 PM
(This post was last modified: Apr 9, 2015 05:00 PM by debug.)
(Apr 9, 2015 04:26 PM)Tedd Wrote: >had an idea that i wanted to try
>didn't feel like figuring out how to code those functions
Something doesn't add up.. Even if it was an idea, don't release it as a solution when it's literally the worst way to handle something.
That's like saying "hm, i'm not sure how to get to the movie theater, so instead of using a map i'm going to get someone to steer my car while i drive to get there, instead of just looking up the address of the theater and putting it in my gps.."
Sure, it works, but it's not a "solution" by any means and I don't think it should be shared as one. ESPECIALLY if you are trying to sell a crypter as "coded from scratch" (calling bs) I'm well aware of the fact that this is a horrible way to do it, hence "ghetto scroll." I did not claim that this was a proper way to do it. And since when is something that completes a designated task, not a solution?
(Apr 9, 2015 04:26 PM)Tedd Wrote: >had an idea that i wanted to try
>didn't feel like figuring out how to code those functions
Something doesn't add up.. Even if it was an idea, don't release it as a solution when it's literally the worst way to handle something.
That's like saying "hm, i'm not sure how to get to the movie theater, so instead of using a map i'm going to get someone to steer my car while i drive to get there, instead of just looking up the address of the theater and putting it in my gps.."
Sure, it works, but it's not a "solution" by any means and I don't think it should be shared as one. ESPECIALLY if you are trying to sell a crypter as "coded from scratch" (calling bs)
He's coded his crypter from scratch, I don't see how thats relevant at all.
Don't believe him? Go buy one of the shitty skidded 6 time sold crypters all over the marketplace.
|