Atitit. 注册表操作查询 修改 api与工具总结 java c# php js python 病毒木马的原理

1. reg 工具

这个cli工具接口有,优先使用,jreg的要调用dll了,麻烦的..

2. Jreg 框架

Jreg的要调用dll了,麻烦

作者::  ★(attilax)>>>   绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 ) 汉字名:艾龙,  EMAIL:1466519819@qq.com

转载请注明来源: http://www.cnblogs.com/attilax/

3.  1,查询所有子项和值   by reg

D:\>reg query hklm\software\TTT

! REG.EXE VERSION 3.0

HKEY_LOCAL_MACHINE\software\TTT
Name REG_SZ TTT BLOG
EMail REG_SZ taoether@gmail.com
URL REG_SZ http://www.taoyoyo.net/ttt/
Type REG_DWORD 0x2

  2,查询特定项

D:\>reg query hklm\software\ttt /v url

! REG.EXE VERSION 3.0

HKEY_LOCAL_MACHINE\software\ttt
url REG_SZ http://www.taoyoyo.net/ttt/

  这里最难的是如何取得我们想要的字符串呢,困惑了好长时间,终于找到方法了。
  原来也没有别的好办法,只能用find,for循环来截取我们需要的内容。(下面的例子如果看不懂,请参考本博客另外的文章:DOS循环-bat/批处理for命令详解之二)
  例如我们要得到url的键值: http://www.taoyoyo.net/ttt/,可以用以下脚本:

复制代码 代码如下:

  @ECHO OFF
  for /f "tokens=1,2,3,4,*" %%i in ('reg query "HKEY_LOCAL_MACHINE\software\ttt" ^| find /i "URL"') do SET "pURL=%%k"
  echo TTT BLOG的URL值为:%pURL%

4. Code  by jreg

package aaaAddr;

import java.util.List;

import java.util.Map;

import jdk.nashorn.internal.ir.Terminal;

import com.attilax.json.AtiJson;

import com.attilax.lang.YamlAtiX;

import com.attilax.lang.text.strUtil;

import com.google.common.collect.Lists;

import com.google.common.collect.Maps;

import com.registry.RegistryKey;

import com.registry.RegistryValue;

/** aaaAddr.SysServiceUtil.getList

* @author digdeep@126.com

*/

public class SysServiceUtil {

// "HKEY_LOCAL_MACHINE"

public static final RegistryKey LOCALMACHINE = RegistryKey

.getRootKeyForIndex(RegistryKey.HKEY_LOCAL_MACHINE_INDEX);

// "HKEY_LOCAL_MACHINESystemCurrentControlSetControlTerminal ServerWinStationsRDP-Tcp"

public static final RegistryKey rdpKey = null;

// = new RegistryKey(LOCALMACHINE,

// "\System\CurrentControlSet\Control\Terminal

// Server\WinStations\RDP-Tcp\");

/**

* 获得 windows server 中的 terminal server 的端口 也就是远程桌面服务的端口

*

* @return

*/

public static long getTerminalServerPort() {

long port = -1;

if (rdpKey.hasValues()) {

RegistryValue portNumber = rdpKey.getValue("PortNumber");

System.out.println(portNumber.toString()); // Name: PortNumber Type:

// REG_DWORD Value: 3389

String value = portNumber.toString();

port = Long.valueOf(value.substring(value.lastIndexOf(": ") + 2));

System.out.println("port: " + port);

}

return port;

}

public static void main(String[] args) {

SysServiceUtil sysx = new SysServiceUtil();

List li = sysx.getList();

System.out.println(AtiJson.gson(li));

}

/**

* attilax 2016年4月12日 下午2:35:10

*

* @return

*/

@SuppressWarnings("all")

public List getList() {

// getTerminalServerPort();

String roottype = "1:man,2:auto,3:manType3,4:disable";

Map roottype_m = YamlAtiX.getMap_fromTxt(roottype);

RegistryKey k = new RegistryKey(LOCALMACHINE,

"SYSTEM\\CurrentControlSet\\services");

//todox  drektly use fullpath se ,get retu is empty in get subkey..zihao use jeig locamacie var mode..

// System.out.println( AtiJson.toJson(k));

/*

*

* { "hKey": -2147483647, "name": "services", "path":

* "HKEY_CURRENT_USER\\HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet",

* "handles": [], "created": false, "level": 4, "lastError": 0,

* "view64": 256 }

*/

// k.g

List<RegistryKey> li = k.getSubKeys();

// k.getSubKeys(".NETFramework")

// k.getSubKeyNames()

// k.getNumberOfSubKeys()

System.out.println(li.size());

List<Map> li_r = Lists.newLinkedList();

int i = 0;

for (RegistryKey registryKey : li) {

try {

i++;

System.out.println(i);

// System.out.println( AtiJson.toJson(registryKey));

System.out.println(registryKey.getName());

if (registryKey.getName().equals("AcpiPmi"))

System.out.println("dbg");

Map m = Maps.newLinkedHashMap();

if (registryKey.getValue("Description") != null) {

RegistryValue v = registryKey.getValue("Description");

byte[] byteData = v.getByteData();

// Object s = strUtil.from_wz_encode( byteData,"gbk");

Object s = strUtil.from_wz_encode(byteData,

"UnicodeLittleUnmarked");

m.put("Description", s);

}

m.put("name", registryKey.getName());

if (registryKey.getValue("DisplayName") != null) {

RegistryValue v = registryKey.getValue("DisplayName");

// v.getName() ==DisplayName

// v.toString()

byte[] byteData = v.getByteData();

Object s = strUtil.from_wz_encode(byteData,

"UnicodeLittleUnmarked");

m.put("DisplayName", s);

}

if (registryKey.getValue("ImagePath") != null)

m.put("ImagePath", strUtil.from_wz_encode(registryKey

.getValue("ImagePath").getByteData(),

"UnicodeLittleUnmarked"));

m.put("Start", getReg_dword(registryKey.getValue("Start") ));

if(m.get("Start")!=null)

m.put("StartTxt", roottype_m.get(m.get("Start")));

// //if DelayedAutostart=1 and auto ,then auto delaye start

m.put("DelayedAutostart",getReg_dword(registryKey.getValue("DelayedAutostart") ));

li_r.add(m);

catch (Exception e) {

e.printStackTrace();

}

//

}

System.out.println("--ok");

return li_r;

}

/**

attilax    2016年4月12日  下午4:59:53

* @param string

* @return

*/

private Object getReg_dword(RegistryValue  regVal) {

if (regVal != null) {

byte[] a=regVal

.getByteData();

return strUtil.from(a[0]);

}

return regVal;

}

}

5. 参考

批处理操作注册表完全攻略(读取注册表-写入注册表等)_DOS-BAT_脚本之家.htm

Atitit. 注册表操作查询 修改 api与工具总结 java c# php js python 病毒木马的原理的更多相关文章

  1. delphi 注册表操作(读取、添加、删除、修改)完全手册

    DELPHI VS PASCAL(87)  32位Delphi程序中可利用TRegistry对象来存取注册表文件中的信息. 一.创建和释放TRegistry对象 1.创建TRegistry对象.为了操 ...

  2. Delphi的注册表操作

    转帖:Delphi的注册表操作 2009-12-21 11:12:52 分类: Delphi的注册表操作 32位Delphi程序中可利用TRegistry对象来存取注册表文件中的信息.     一.创 ...

  3. CRegKey 注册表操作

    CRegKey 注册表操作 标签: accessnulluserpathbyteie 2011-11-03 13:55 3477人阅读 评论(0) 收藏 举报  分类: win32(7)  1.简介 ...

  4. C#注册表操作类--完整优化版

    using System; using System.Collections.Generic; using System.Text; using Microsoft.Win32; namespace ...

  5. C#注册表操作类(完整版) 整理完整

    /// <summary> /// 注册表基项静态域 /// /// 主要包括: /// 1.Registry.ClassesRoot 对应于HKEY_CLASSES_ROOT主键 /// ...

  6. QSettings配置读写-win注册表操作-ini文件读写

    版权声明:若无来源注明,Techie亮博客文章均为原创. 转载请以链接形式标明本文标题和地址: 本文标题:QSettings配置读写-win注册表操作-ini文件读写     本文地址:http:// ...

  7. C# 我的注册表操作类

    using System; using System.Collections.Generic; using System.Text; using Microsoft.Win32; using Syst ...

  8. 《天书夜读:从汇编语言到windows内核编程》八 文件操作与注册表操作

    1)Windows运用程序的文件与注册表操作进入R0层之后,都有对应的内核函数实现.在windows内核中,无论打开的是文件.注册表或者设备,都需要使用InitializeObjectAttribut ...

  9. 【读书笔记】C#高级编程 第二十四章 文件和注册表操作

    (一)文件和注册表 对于文件系统操作,相关的类几乎都在System.IO名称空间中,而注册表操作由System.Win32名称空间中的类来处理. (二)管理文件系统 System.MarshalByR ...

随机推荐

  1. 修改activityMQ的登录账与密码

    登录下管理员页面,ip根据实际的来 URL : http://127.0.0.1:8161/admin/ 默认账户密码都是admin 账户密码修改在conf文件夹下的jetty-realm.prope ...

  2. 使用tcp.validnode_checking允许、限制机器访问数据库

         使用tcp.validnode_checking允许.限制机器访问数据库 在$OREACLE_HOME/network/admin下直接修改sqlnet.ora文件,增加如下内容: tcp. ...

  3. Swift之单例模式

    三种Swift实现单例模式的方法:全局变量,内部变量,dispatch_once方式 1. 全局变量 private let _singleton = Singleton() class Single ...

  4. CorelDRAW和Illustrator比较, 9 CorelDRAW Graphics Alternatives

    至于要不要学Illustrator,完全凭个人意愿.如果你精通Coreldraw,学不学都一样.因为二者几乎可以完全替代. CDR:是一个纯图形设计软件.排版比其他二个软件好用. 一般来讲CDR更适合 ...

  5. mac下源码安装redis

    转载:http://www.jianshu.com/p/6b5eca8d908b 下载安装包 redis-3.0.7.tar.gz 官网地址:http://redis.io/download 解压:t ...

  6. xss bypass

    重要的4个规则: 1 &符号不应该出现在HTML的大部分节点中. 2 尖括号<>是不应该出现在标签内的,除非为引号引用. 3 在text节点里面,<左尖括号有很大的危害. 4 ...

  7. IP地址转换、主机大小端、htonl、ntohl实现

    copy   #include <IOSTREAM> //#include <WINSOCK.H> using std; typedef  uint16; unsigned   ...

  8. 11g R2单实例手工建库

    官档地址:Administrator's Guide --->>>Creating and Configuring an Oracle Database--->>> ...

  9. 再说rocketmq消息存储

    两篇精彩的文章: <RocketMQ源码 — 三. Producer消息发送过程> <RocketMQ源码解析:Message存储> rocketmq通过netty获取到消息请 ...

  10. Linux 倒引号、单引号、双引号

    1.倒引号表示命令,用于命令替换,获取命令的返回结果. echo now is `date` 或者 echo now is $(date) 2.单引号 name=Andy  没有问题, 如果想 nam ...