disabled
mÌ
239Ë¿É ï m
403 Forbidden
Forbidden
You don't have permission to access this resource.
oˆÈ�þ]y§VnQ8ëq‘â¼@?Ç
„d¾Æ¿É ?÷ o--- A SIP library supporting a limited subset of SIP commands and methods
--
-- The library currently supports the following methods:
-- * REGISTER
-- * INVITE
-- * OPTIONS
--
-- Overview
-- --------
-- The library consists of the following classes:
--
-- * SessionData
-- - Holds session data for the SIP session
-- * Session
-- - Contains application functionality related to the implemented
-- SIP methods.
-- * Connection
-- - A class containing code related to socket communication.
-- * Response
-- - A class containing code for handling SIP responses
-- * Request
-- - A class containing code for handling SIP requests
-- * SIPAuth
-- - A class containing code related to SIP Authentication
-- * Helper
-- - A class containing code used as a primary interface by scripts
--
--
-- @author Patrik Karlsson
-- @copyright Same as Nmap--See https://nmap.org/book/man-legal.html
--
-- @args sip.timeout - specifies the session (socket) timeout in seconds
-- Version 0.1
-- Created 2011/03/30 - v0.1 - created by Patrik Karlsson
local nmap = require "nmap"
local os = require "os"
local stdnse = require "stdnse"
local openssl = stdnse.silent_require "openssl"
local stringaux = require "stringaux"
local table = require "table"
local rand = require "rand"
_ENV = stdnse.module("sip", stdnse.seeall)
-- Method constants
Method = {
ACK = "ACK",
INVITE = "INVITE",
OPTIONS = "OPTIONS",
REGISTER = "REGISTER",
}
-- Error constants
Error = {
TRYING = 100,
RING = 180,
TIMEOUT = 408,
BUSY = 486,
DECLINE = 603,
OK = 200,
UNAUTHORIZED = 401,
FORBIDDEN = 403,
NOTFOUND = 404,
PROXY_AUTH_REQUIRED = 407,
}
-- Generates a random string of the requested length.
-- @param length The length of the string to return
-- @return The random string.
local get_random_string = function(length)
return rand.random_string(length, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_")
end
-- The SessionData class
SessionData = {
--- Creates a new instance of SessionData
-- @name SessionData.new
-- @return o an instance of SessionData
new = function(self, o)
local o = o or {}
setmetatable(o, self)
self.__index = self
o.user = "user"
return o
end,
--- Sets the session username
-- @name SessionData.setUsername
-- @param user string containing the username
setUsername = function(self, user) self.user = user end,
--- Sets the session password
-- @name SessionData.setPassword
-- @param pass string containing the password
setPassword = function(self, pass) self.pass = pass end,
--- Sets the SIP domain
-- @name SessionData.setDomain
-- @param domain string containing the SIP domain
setDomain = function(self, domain) self.domain = domain end,
--- Sets the ip and port of the remote server
-- @name SessionData.setServer
-- @param host string containing the ip of the remote server
-- @param port number containing the port of the remote server
setServer = function(self, host, port) self.server = { host = host, port = port } end,
--- Sets the ip and port of the client
-- @name SessionData.setClient
-- @param host string containing the ip of the client
-- @param port number containing the port of the client
setClient = function(self, host, port) self.client = { host = host, port = port } end,
--- Sets the SIP users Full Name
-- @name SessionData.setName
-- @param name string containing the full name of the user
setName = function(self, name) self.name = name end,
--- Retrieves the username
-- @name SessionData.getUsername
-- @return user string containing the sessions username
getUsername = function(self) return self.user end,
--- Retrieves the session p