不少人都知道使用linux能够利用sudo来执行一些root权限执行的事情,可是sudo和root仍是有很大的区别的。linux
一、获取root的权限,也并非没有前提的,至少具有/etc/password和/etc/shadow的其中一个文件的修改权限,这个并不是root自己才能执行,通常拿到了帐号密码的普通帐号均可以作到,对于非root的帐号的sudo权限限制,并非作的那么好。二、具有密码hash生成机,这个很简单,能够用c语言编写一个,编译后,随处可用。和密码爆破机的原理如出一辙。ubuntu
#include <stdio.h> #include <crypt.h> #include <unistd.h> #include <string.h> #include <stdlib.h> int main(int argc, char *argv[]){ //const char *userPassword = "1234"; //const char *saltString = "$6$UaS4js6$"; printf("%s\n",crypt((const char*)argv[1], (const char*)argv[2])); //printf("%s\n", hashString); } + 使用方法:
./crack 1234 $6$UaS4js6$tcp
+ 效果:  ## 覆盖密码: *** ### 一、配置ubuntu的root密码为toor1234
bobac@ubuntu:~$ sudo passwd root
[sudo] password for bobac:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
```code