|  |  | @ -122,87 +122,6 @@ std::vector<std::string> split(std::string text, char delim) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |     return vec; |  |  |  |     return vec; | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | unsigned short read_uid_min_max(string filename, string search) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     std::string line; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     int uid = 0; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     string remove_tab = "\t"; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     string remove_space = " "; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     std::ifstream in(filename); // окрываем файл для чтения
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     if (in.is_open()){ |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         while (getline(in, line)){ |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             try{ |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (line.find(search) != string::npos && (line.find("SYS_"+search) == string::npos)) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     str_remove(line, search); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     str_remove(line, remove_space); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     str_remove(line, remove_tab); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     uid = atoi(line.c_str()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             catch (int x) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (search == "UID_MIN"){ |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     uid = 1000; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 else{ |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     uid = 65534; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     else{ |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (search == "UID_MIN") { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             uid = 1000; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         else{ |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             uid = 65534; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     in.close();  |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     return uid; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | vector <string> pars_users() { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     vector <string> vec_users; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     unsigned short uid_min = read_uid_min_max("/etc/login.defs", "UID_MIN"); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     unsigned short uid_max =read_uid_min_max("/etc/login.defs", "UID_MAX"); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     while (true) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         errno = 0; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         passwd* entry = getpwent(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (!entry) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (errno) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 break; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             break; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         if ((entry->pw_uid >= uid_min && entry->pw_uid < uid_max) || entry->pw_uid == 0) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             vec_users.push_back(string(entry->pw_name)); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     endpwent(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     return vec_users; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | }  |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | string read_passwd(string username) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     string passwd = ""; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     std::string line; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     std::ifstream in("/etc/shadow"); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     if (in.is_open()) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         while (getline(in, line)) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (line.find(username) != string::npos) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 size_t index_start = line.find(":"); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (index_start != string::npos) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     size_t index_end = line.find(":", index_start + 1); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     passwd = line.substr(index_start+1, index_end - index_start-1); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     break; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 }     |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     in.close();  |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     return passwd; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | int synopsis_show(string str_link) { |  |  |  | int synopsis_show(string str_link) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     // gettext("https://wiki.ublinux.com/ru/Программное_обеспечение/Программы_и_утилиты/Все/")
 |  |  |  |     // gettext("https://wiki.ublinux.com/ru/Программное_обеспечение/Программы_и_утилиты/Все/")
 | 
			
		
	
	
		
		
			
				
					|  |  | 
 |