# Var

Command:&#x20;

`var`

Syntax:

```bash
var <var_name> = <value>
```

Example:

```bash
var myVar = 'Text here'
print myVar
Text here

```

You can use variables in several diverse ways, here are some examples:

In commands:

```bash
var url = "http://example.com"
server url
```

In options:

```bash
zirkul(plugin)# url: varname
```

Within formatted string values:

```bash
zirkul(scanner)# url "http://{{var_name}}"
zirkul(scan)# summary: "My Scan for {{var_name}}"
```

### There are also reserved variables for dates, time, paths or objects.

Current date:

```bash
print date
Mar-27-2095
```

Current time:

```bash
print now
2095-03-27 13:52:56
```

Current time in UTC time zone:

```bash
print utcnow
2024-03-27 19:55:29
```

Current day of the month in numeric format:

```bash
print day
27
```

Current month in numeric format:

```
print month
3
```

Current year in numeric format:

```bash
print year
2095
```

Current hour, minute and second:

<pre><code>print 'Time = {{hour}} : {{minute}} : {{second}}'
<strong>Time = 12 : 35 : 47
</strong></code></pre>

Current working directory:

```bash
print working_path
/Applications/zirkul.app/Contents/MacOS
```

Path based on agent current location:

```bash
print binary_path
/user/Documents
```

The scan object is created when a scan is loaded or created, you can use the object directly or it's attributes as follows:

```bash
zirkul#scan 2
[ + ] Vulnerability data retrieved from server: Success
[ + ] Scan data retrieved from server: Success
zirkul(scan)#print scan
Current scan:
==================================================
id                                                 => 2
targetid                                           => 339
subject                                            => 'Network Scan - Internal'
description                                        => '192.168.90.0/24'
scan_type                                          => 'Network Scan'
status                                             => 'Completed'
created_date                                       => '2021-01-18 13:12:13'
created_by                                         => 'user@example.com'
created_api                                        => False
last_modified_date                                 => '2024-03-26 21:00:10'
last_modified_by                                   => 'admin@zirkul.com'
last_modified_api                                  => False
Attributes:
ip                                                 => '192.168.90.0/24'
testing_environment_type                           => 'Internal'
assignee                                           => 'user@client.com'
Compliance:
rating                                             => 'F'
critical                                           => 1
high                                               => 4
medium                                             => 78
low                                                => 16
informational                                      => 0

zirkul(scan)#print scan.scan_type
Network Scan
zirkul(scan)#
```

The target object is created when a target is loaded, you can use the object directly or it's attributes as follows:

```bash
zirkul#target 1
[ ! ] Target loaded successfully: 1
zirkul#print target
Current target:
==================================================
id                                                 => 1
target_type                                        => 'Network range'
owner                                              => <not set>
name                                               => 'Dolphin'
description                                        => 'Internal network in Dolphin offices'
created_date                                       => '2021-01-18 13:11:47'
created_by_api                                     => False
created_by                                         => 'user@example.com'
last_modified_date                                 => '2021-10-21 21:31:00'
last_modified_by_api                               => False
last_modified_by                                   => 'user@example.com'
Compliance:
rating                                             => 'A+'
critical                                           => 0
high                                               => 0
medium                                             => 0
low                                                => 0
informational                                      => 0
zirkul#
zirkul#print target.name
Dolphin
zirkul#
```

There's also an object called 'issues' created by the internal scanner or plugins containing the list of issues detected in the current session, you can get the summary of all issues as well as details for every specific issue as follows:

```
zirkul#print issues
Local issues data:
==================================================
issues.count                                       => 15
issues.critical                                    => 0
issues.high                                        => 0
issues.medium                                      => 3
issues.low                                         => 12
issues.info                                        => 0
==================================================
You can also get more details from any issue:
   print issues[1]
   print issues[1].details
   
zirkul#print issues.count
15
zirkul#print issues[1].type
Missing X-Frame-Options Header
```
