Project

General

Profile

Restoring Lost User Account » History » Version 5

Luke Murphey, 09/30/2010 01:04 AM

1 3 Luke Murphey
h1. Restoring a User Account From the Command-Line
2 1 Luke Murphey
3 5 Luke Murphey
The command-line interface (CLI) provides a number of mechanisms for managing NSIA if you cannot access the web-interface. To access the CLI, *stop NSIA* and run the following command from a shell within the bin directory:
4 1 Luke Murphey
5 1 Luke Murphey
<pre>
6 1 Luke Murphey
java -jar nsia.jar
7 1 Luke Murphey
</pre>
8 1 Luke Murphey
9 1 Luke Murphey
The interactive CLI will appear. Type help to see all commands. To restore access, use one of the following CLI commands:
10 1 Luke Murphey
11 1 Luke Murphey
* User.SetPassword
12 1 Luke Murphey
* User.Unlock
13 1 Luke Murphey
* User.Enable
14 1 Luke Murphey
* User.Add
15 5 Luke Murphey
16 5 Luke Murphey
For example, if you need to change a user's password do the following steps:
17 5 Luke Murphey
18 5 Luke Murphey
First, start NSIA from the command-line
19 5 Luke Murphey
20 5 Luke Murphey
<pre>
21 5 Luke Murphey
ThreatFactor NSIA 0.9.9 (http://ThreatFactor.com)
22 5 Luke Murphey
Web server running on: http://127.0.0.1:8080
23 5 Luke Murphey
24 5 Luke Murphey
Interactive console, type help for list of commands
25 5 Luke Murphey
>
26 5 Luke Murphey
</pre>
27 5 Luke Murphey
28 5 Luke Murphey
29 5 Luke Murphey
30 5 Luke Murphey
Next, run "User.List" to list the users:
31 5 Luke Murphey
32 5 Luke Murphey
<pre>
33 5 Luke Murphey
> User.List
34 5 Luke Murphey
35 5 Luke Murphey
Login Name     Full Name     User ID     Status     Is Unrestricted     
36 5 Luke Murphey
------------------------------------------------------------------------
37 5 Luke Murphey
Luke           Luke          1           Active     yes                 
38 5 Luke Murphey
John           John          2           Active     yes                 
39 5 Luke Murphey
Matthew        Matthew       3           Active     no                  
40 5 Luke Murphey
Mark           Mark          4           Active     no                  
41 5 Luke Murphey
</pre>
42 5 Luke Murphey
43 5 Luke Murphey
We are going to use the "User.setPassword" function to reset the password. Run the command with no arguments to see the necessary arguments:
44 5 Luke Murphey
<pre>
45 5 Luke Murphey
> User.setPassword
46 5 Luke Murphey
47 5 Luke Murphey
Error: too few arguments provided, syntax of the command is "User.SetPassword <username> <password>"
48 5 Luke Murphey
</pre>
49 5 Luke Murphey
50 5 Luke Murphey
Now run the command to set the password (you don't have to provide the password if you want it to prompt for it):
51 5 Luke Murphey
<pre>
52 5 Luke Murphey
> User.setPassword Mark 
53 5 Luke Murphey
54 5 Luke Murphey
Enter the user's password: 
55 5 Luke Murphey
Enter the user's password again: 
56 5 Luke Murphey
Password successfully changed
57 5 Luke Murphey
> 
58 5 Luke Murphey
</pre>
59 5 Luke Murphey
60 5 Luke Murphey
Now shutdown NSIA and restart it using the Windows Service, Unix daemon script or however you usually run it:
61 5 Luke Murphey
<pre>
62 5 Luke Murphey
> exit
63 5 Luke Murphey
64 5 Luke Murphey
System is shutting down...Done
65 5 Luke Murphey
</pre>
66 5 Luke Murphey
67 5 Luke Murphey
<pre>
68 5 Luke Murphey
</pre>