diff --git a/nselib/afp.lua b/nselib/afp.lua index 81db01b6c..97775107f 100644 --- a/nselib/afp.lua +++ b/nselib/afp.lua @@ -911,9 +911,7 @@ Proto = { local username = username or "" local password = password or "" - if ( bit.mod(username:len(), 2) == 0 ) then - username = username .. string.char(0) - end + username = username .. string.rep('\0', (#username + 1) % 2) p = openssl.bignum_hex2bn("BA2873DFB06057D43F2024744CEEE75B") g = openssl.bignum_dec2bn("7") diff --git a/nselib/data/psexec/default.lua b/nselib/data/psexec/default.lua index 6a3290aeb..cc3195381 100644 --- a/nselib/data/psexec/default.lua +++ b/nselib/data/psexec/default.lua @@ -2,6 +2,7 @@ -- programs to gather information about the remote system. It's intended to be -- simple, demonstrate some of the concepts, and not break/alte anything. +local table = require "table" -- Any variable in the 'config' table in smb-psexec.nse can be overriden in the -- 'overrides' table. Most of them are not really recommended, such as the host, @@ -137,7 +138,7 @@ mod.upload = false mod.name = "Drive list (for more info, try adding --script-args=config=drives,drive=C:)" mod.program = "fsutil" mod.args = "fsinfo drives" -mod.replace = {{string.char(0), " "}} +mod.replace = {{"\0", " "}} mod.maxtime = 1 table.insert(modules, mod) diff --git a/nselib/dhcp.lua b/nselib/dhcp.lua index f40b2484f..43b6d70e4 100644 --- a/nselib/dhcp.lua +++ b/nselib/dhcp.lua @@ -429,9 +429,9 @@ function dhcp_build(request_type, ip_address, mac_address, options, request_opti packet = packet .. bin.pack("I", overrides['cookie'] or 0x63825363) -- Magic cookie -- Options diff --git a/nselib/drda.lua b/nselib/drda.lua index 5aab6e91e..1d2ffbc99 100644 --- a/nselib/drda.lua +++ b/nselib/drda.lua @@ -600,7 +600,7 @@ Helper = { local drda_excsat = Command.EXCSAT( "", "", "", mgrlvlls, "" ) local drda_accsec = Command.ACCSEC( secmec, database ) local drda_secchk = Command.SECCHK( secmec, database, username, password ) - local drda_accrdb = Command.ACCRDB( database, string.char(0x24,0x07), "DNC10060", nil, "QTDSQLASC", crrtkn, tdovr) + local drda_accrdb = Command.ACCRDB( database, "\x24\x07", "DNC10060", nil, "QTDSQLASC", crrtkn, tdovr) local status, packet = self.comm:exchDRDAPacket( DRDAPacket:new( { drda_excsat, drda_accsec } ) ) if( not(status) ) then return false, packet end diff --git a/nselib/giop.lua b/nselib/giop.lua index 17ece68dd..642cf7a13 100644 --- a/nselib/giop.lua +++ b/nselib/giop.lua @@ -57,7 +57,6 @@ local bin = require "bin" local match = require "match" local nmap = require "nmap" local stdnse = require "stdnse" -local string = require "string" local table = require "table" _ENV = stdnse.module("giop", stdnse.seeall) @@ -555,8 +554,8 @@ Helper = { local packet = Packet.GIOP.get:new( 5, 0x494e4954, bin.pack(">IA", #Constants.NAMESERVICE, Constants.NAMESERVICE) ) local status, ctx, lhost, pos, len, bo, tmp - packet:addServiceContext( 17, string.char(0x00, 0x02), 0) - packet:addServiceContext( Constants.ServiceContext.NEO_FIRST_SERVICE_CONTEXT, string.char(0x00, 0x14), 0) + packet:addServiceContext( 17, "\0\x02", 0) + packet:addServiceContext( Constants.ServiceContext.NEO_FIRST_SERVICE_CONTEXT, "\0\x14", 0) packet:addServiceContext( Constants.ServiceContext.SENDING_CONTEXT_RUNTIME, tostring(SendingContextRuntime:new( self.lhost )), 0 ) status, packet = self.comm:exchGIOPPacket( packet ) @@ -575,7 +574,7 @@ Helper = { packet:addServiceContext( 17, "\0\2", 0x000d) packet:addServiceContext( Constants.ServiceContext.CODESETS, "\0\0\0\0\0\1\0\1\0\1\1\9" ) - packet:addServiceContext( Constants.ServiceContext.NEO_FIRST_SERVICE_CONTEXT, string.char(0x00, 0x14), 0x5d69) + packet:addServiceContext( Constants.ServiceContext.NEO_FIRST_SERVICE_CONTEXT, "\0\x14", 0x5d69) packet:addServiceContext( Constants.ServiceContext.SENDING_CONTEXT_RUNTIME, tostring(SendingContextRuntime:new( self.lhost )), 0 ) status, packet = self.comm:exchGIOPPacket( packet ) @@ -584,7 +583,7 @@ Helper = { packet = Packet.GIOP.list:new( Constants.ServiceContext.SENDING_CONTEXT_RUNTIME, Constants.SyncScope.WITH_TARGET, keyaddr, 1000 ) packet:addServiceContext( 17, "\0\2", 0x000d) packet:addServiceContext( Constants.ServiceContext.CODESETS, "\0\0\0\0\0\1\0\1\0\1\1\9" ) - packet:addServiceContext( Constants.ServiceContext.NEO_FIRST_SERVICE_CONTEXT, string.char(0x00, 0x14), 0x9c9b) + packet:addServiceContext( Constants.ServiceContext.NEO_FIRST_SERVICE_CONTEXT, "\0\x14", 0x9c9b) status, packet = self.comm:exchGIOPPacket( packet ) if( not(status) ) then return status, packet end diff --git a/nselib/json.lua b/nselib/json.lua index 735a27833..a54575cdd 100644 --- a/nselib/json.lua +++ b/nselib/json.lua @@ -205,14 +205,14 @@ local ESCAPE_TABLE = {} local REVERSE_ESCAPE_TABLE = {} do local escapes = { - [string.char(0x22)] = "\"", - [string.char(0x5C)] = "\\", - [string.char(0x2F)] = "/", - [string.char(0x08)] = "b", - [string.char(0x0C)] = "f", - [string.char(0x0A)] = "n", - [string.char(0x0D)] = "r", - [string.char(0x09)] = "t", + ["\x22"] = "\"", + ["\x5C"] = "\\", + ["\x2F"] = "/", + ["\x08"] = "b", + ["\x0C"] = "f", + ["\x0A"] = "n", + ["\x0D"] = "r", + ["\x09"] = "t", } for k, v in pairs(escapes) do ESCAPE_TABLE[k] = "\\" .. v diff --git a/nselib/mongodb.lua b/nselib/mongodb.lua index 1ab683c64..2860e53be 100644 --- a/nselib/mongodb.lua +++ b/nselib/mongodb.lua @@ -151,7 +151,7 @@ end --@return the remaining data (*without* null-char) local function get_c_string(data,length) if not length then - local index = data:find(string.char(0)) + local index = data:find('\0') if index == nil then error({code="C-string did not contain NULL char"}) end diff --git a/nselib/msrpc.lua b/nselib/msrpc.lua index e3733d82c..c598e23af 100644 --- a/nselib/msrpc.lua +++ b/nselib/msrpc.lua @@ -5018,7 +5018,7 @@ function DNSSERVER_Query(smbstate, server_name, zone, operation) if(zone == nil) then req_blob = bin.pack(" 0 ) and unicode.utf8to16(domain) or "" ntlm = (#username > 0 ) and ntlm or "" - lanman = (#username > 0 ) and lanman or string.char(0) + lanman = (#username > 0 ) and lanman or '\0' local domain_offset = 0x40 local username_offset = domain_offset + #domain @@ -916,7 +914,7 @@ function calculate_signature(mac_key, data) if(have_ssl) then return string.sub(openssl.md5(mac_key .. data), 1, 8) else - return string.rep(string.char(0), 8) + return string.rep('\0', 8) end end diff --git a/nselib/ssh2.lua b/nselib/ssh2.lua index 9b410af3d..2cfa416a9 100644 --- a/nselib/ssh2.lua +++ b/nselib/ssh2.lua @@ -8,7 +8,6 @@ local base64 = require "base64" local bin = require "bin" local nmap = require "nmap" local stdnse = require "stdnse" -local string = require "string" local openssl = stdnse.silent_require "openssl" _ENV = stdnse.module("ssh2", stdnse.seeall) @@ -61,7 +60,7 @@ transport.pack_mpint = function( bn ) packed = bn:tobin() if bytes % 8 == 0 then bytes = bytes + 1 - packed = string.char(0) .. packed + packed = '\0' .. packed end return bin.pack( ">IA", bytes, packed ) end diff --git a/nselib/tls.lua b/nselib/tls.lua index 8a9a958e6..c7428fc41 100644 --- a/nselib/tls.lua +++ b/nselib/tls.lua @@ -1248,7 +1248,7 @@ function client_hello(t) table.insert(b, stdnse.generate_random_string(28)) -- Set the session ID. - table.insert(b, bin.pack("C", 0)) + table.insert(b, '\0') -- Cipher suites. ciphers = {} diff --git a/nselib/tns.lua b/nselib/tns.lua index 08379a5e9..310d73533 100644 --- a/nselib/tns.lua +++ b/nselib/tns.lua @@ -1216,7 +1216,7 @@ Marshaller = { else -- Otherwise, it's a bit more involved: -- First, write the multiple-chunk indicator - result = result .. bin.pack( "C", 0xFE ) + result = result .. "\xFE" -- Loop through the string, chunk by chunk while ( #value > 0 ) do @@ -1235,7 +1235,7 @@ Marshaller = { end -- put a null byte at the end - result = result .. bin.pack( "C", 0 ) + result = result .. '\0' end end diff --git a/scripts/citrix-enum-apps.nse b/scripts/citrix-enum-apps.nse index c65dd9b12..e11cd11ed 100644 --- a/scripts/citrix-enum-apps.nse +++ b/scripts/citrix-enum-apps.nse @@ -138,7 +138,7 @@ action = function(host, port) -- if it is set to zero (0) we have more response packets to process -- if it is set to one (1) we have arrived at the last packet of our journey -- - while packet:sub(31,31) ~= string.char(0x01) do + while packet:sub(31,31) ~= "\x01" do packet = try( socket:receive() ) local tmp_table = process_pa_response( packet ) diff --git a/scripts/citrix-enum-servers.nse b/scripts/citrix-enum-servers.nse index 3f468400f..f9ad4b035 100644 --- a/scripts/citrix-enum-servers.nse +++ b/scripts/citrix-enum-servers.nse @@ -126,7 +126,7 @@ action = function(host, port) -- if it is set to zero (0) we have more response packets to process -- if it is set to one (1) we have arrived at the last packet of our journey -- - while packet:sub(31,31) ~= string.char(0x01) do + while packet:sub(31,31) ~= "\x01" do packet = try( socket:receive() ) local tmp_table = process_server_response( packet ) diff --git a/scripts/db2-das-info.nse b/scripts/db2-das-info.nse index 2cc6f7f72..fabe27ea2 100644 --- a/scripts/db2-das-info.nse +++ b/scripts/db2-das-info.nse @@ -183,7 +183,7 @@ function read_db2_packet(socket) packet.header.raw = buf:sub(1, header_len) - if packet.header.raw:sub(1, 10) == string.char(0x00, 0x00, 0x00, 0x00, 0x44, 0x42, 0x32, 0x44, 0x41, 0x53) then + if packet.header.raw:sub(1, 10) == "\x00\x00\x00\x00\x44\x42\x32\x44\x41\x53" then stdnse.debug1("Got DB2DAS packet") diff --git a/scripts/dns-random-srcport.nse b/scripts/dns-random-srcport.nse index 8becca767..bbb3c716c 100644 --- a/scripts/dns-random-srcport.nse +++ b/scripts/dns-random-srcport.nse @@ -64,8 +64,8 @@ action = function(host, port) 0x00, 0x00, -- Authority RRs 0x00, 0x00, -- Additional RRs 0x08) .. "porttest" .. - string.char( 0x08) .. "dns-oarc" .. - string.char( 0x03) .. "net" .. + "\x08" .. "dns-oarc" .. + "\x03" .. "net" .. string.char( 0x00, -- Name terminator 0x00, 0x10, -- Type (TXT) 0x00, 0x01) -- Class (IN) diff --git a/scripts/dns-random-txid.nse b/scripts/dns-random-txid.nse index 75455bb38..708a40e40 100644 --- a/scripts/dns-random-txid.nse +++ b/scripts/dns-random-txid.nse @@ -64,8 +64,8 @@ action = function(host, port) 0x00, 0x00, -- Authority RRs 0x00, 0x00, -- Additional RRs 0x08) .. "txidtest" .. - string.char( 0x08) .. "dns-oarc" .. - string.char( 0x03) .. "net" .. + "\x08" .. "dns-oarc" .. + "\x03" .. "net" .. string.char( 0x00, -- Name terminator 0x00, 0x10, -- Type (TXT) 0x00, 0x01) -- Class (IN) diff --git a/scripts/firewall-bypass.nse b/scripts/firewall-bypass.nse index 42af026b8..99005ae35 100644 --- a/scripts/firewall-bypass.nse +++ b/scripts/firewall-bypass.nse @@ -73,12 +73,12 @@ ftp_helper = { bit.band(bit.rshift(targetport, 8), 0xff) .. "," .. bit.band(targetport, 0xff) .. ")\r\n" - ethertype = string.char(0x08, 0x00) -- Ethernet Type: IPv4 + ethertype = "\x08\0" -- Ethernet Type: IPv4 else -- IPv6 payload payload = "229 Extended Passive Mode OK (|||" .. targetport .. "|)\r\n" - ethertype = string.char(0x86, 0xdd) -- Ethernet Type: IPv6 + ethertype = "\x86\xdd" -- Ethernet Type: IPv6 end helperport = helperport or 21 diff --git a/scripts/ipv6-ra-flood.nse b/scripts/ipv6-ra-flood.nse index 1e6aaa9d2..213957691 100644 --- a/scripts/ipv6-ra-flood.nse +++ b/scripts/ipv6-ra-flood.nse @@ -106,13 +106,13 @@ local function build_router_advert(mac_src,prefix,prefix_len,valid_time,preferre 0x00,0x00,0x00,0x00, --reachable time 0x00,0x00,0x00,0x00) --retrans timer - local mtu_option_msg = string.char(0x00, 0x00) .. -- reserved + local mtu_option_msg = "\0\0" .. -- reserved packet.numtostr32(mtu) -- MTU local prefix_option_msg = string.char(prefix_len, 0xc0) .. --flags: Onlink, Auto packet.set_u32("....", 0, valid_time) .. -- valid lifetime packet.set_u32("....", 0, preferred_time) .. -- preferred lifetime - string.char(0,0,0,0) .. --unknown + "\0\0\0\0" .. --unknown prefix local icmpv6_mtu_option = packet.Packet:set_icmpv6_option(packet.ND_OPT_MTU, mtu_option_msg) diff --git a/scripts/krb5-enum-users.nse b/scripts/krb5-enum-users.nse index 17000f69d..b5268b235 100644 --- a/scripts/krb5-enum-users.nse +++ b/scripts/krb5-enum-users.nse @@ -231,7 +231,7 @@ KRB5 = { data = bin.pack(">I", kdc_options) .. data -- add padding - data = bin.pack("C", 0) .. data + data = '\0' .. data -- hmm, wonder what this is data = bin.pack("H", "A0070305") .. data diff --git a/scripts/metasploit-info.nse b/scripts/metasploit-info.nse index 515f942ab..055ef8915 100644 --- a/scripts/metasploit-info.nse +++ b/scripts/metasploit-info.nse @@ -55,31 +55,31 @@ local get_prefix = function(data) if string.len(data) <= 31 then return bin.pack("C",0xa0 + string.len(data)) else - return bin.pack("C",0xda) .. bin.pack("s",string.len(data)) + return "\xda" .. bin.pack("s",string.len(data)) end end -- returns a msgpacked data for console.read local encode_console_read = function(method,token, console_id) - return bin.pack("C",0x93) .. get_prefix(method) .. method .. bin.pack("H","da0020") .. token .. get_prefix(console_id) .. console_id + return "\x93" .. get_prefix(method) .. method .. "\xda\x00\x20" .. token .. get_prefix(console_id) .. console_id end -- returns a msgpacked data for console.write local encode_console_write = function(method, token, console_id, command) - return bin.pack("C",0x94) .. get_prefix(method) .. method .. bin.pack("H","da0020") .. token .. get_prefix(console_id) .. console_id .. get_prefix(command) .. command + return "\x94" .. get_prefix(method) .. method .. "\xda\x00\x20" .. token .. get_prefix(console_id) .. console_id .. get_prefix(command) .. command end -- returns a msgpacked data for auth.login local encode_auth = function(username, password) local method = "auth.login" - return bin.pack("C",0x93) .. bin.pack("C",0xaa) .. method .. get_prefix(username) .. username .. get_prefix(password) .. password + return "\x93\xaa" .. method .. get_prefix(username) .. username .. get_prefix(password) .. password end -- returns a msgpacked data for any method without extra parameters local encode_noparam = function(token,method) -- token is always the same length - return bin.pack("C",0x92) .. get_prefix(method) .. method .. bin.pack("H","da0020") .. token + return "\x92" .. get_prefix(method) .. method .. "\xda\x00\x20" .. token end -- does the actual call with specified, pre-packed data diff --git a/scripts/metasploit-msgrpc-brute.nse b/scripts/metasploit-msgrpc-brute.nse index 85709268c..71e0e9490 100644 --- a/scripts/metasploit-msgrpc-brute.nse +++ b/scripts/metasploit-msgrpc-brute.nse @@ -48,15 +48,15 @@ local encode = function(username, password) if string.len(username) <= 31 then -- http://wiki.msgpack.org/display/MSGPACK/Format+specification#Formatspecification-fixraw username_prefix = bin.pack("C",0xa0 + string.len(username)) else -- http://wiki.msgpack.org/display/MSGPACK/Format+specification#Formatspecification-raw16 - username_prefix = bin.pack("C",0xda) .. bin.pack("s",string.len(username)) + username_prefix = "\xda" .. bin.pack("s",string.len(username)) end if string.len(password) <= 31 then password_prefix = bin.pack("C",0xa0 + string.len(password)) else - password_prefix = bin.pack("C",0xda) .. bin.pack("s",string.len(password)) + password_prefix = "\xda" .. bin.pack("s",string.len(password)) end - return bin.pack("C",0x93) .. bin.pack("C",0xaa) .. method .. username_prefix .. username .. password_prefix .. password + return "\x93\xaa" .. method .. username_prefix .. username .. password_prefix .. password end Driver = { diff --git a/scripts/metasploit-xmlrpc-brute.nse b/scripts/metasploit-xmlrpc-brute.nse index 84622f66e..234689db6 100644 --- a/scripts/metasploit-xmlrpc-brute.nse +++ b/scripts/metasploit-xmlrpc-brute.nse @@ -51,7 +51,7 @@ Driver = end, login = function( self, username, password ) - local xmlreq='auth.login'..username..''..password.."\n"..string.char(0) + local xmlreq='auth.login'..username..''..password.."\n\0" local status, err = self.socket:send(xmlreq) if ( not ( status ) ) then @@ -84,7 +84,7 @@ Driver = action = function(host, port) -- first determine whether we need SSL or not - local xmlreq='core.version\n'..string.char(0) + local xmlreq='core.version\n\0' local socket, _, opts = comm.tryssl(host, port, xmlreq, { recv_first = false } ) if ( not(socket) ) then return "\n ERROR: Failed to determine whether SSL was needed or not" diff --git a/scripts/ntp-monlist.nse b/scripts/ntp-monlist.nse index a39c2b034..f3d5d90e1 100644 --- a/scripts/ntp-monlist.nse +++ b/scripts/ntp-monlist.nse @@ -255,7 +255,7 @@ function getPrivateMode(impl, requestCode) 0x00, 0x00, 0x00, 0x00 ) -- Data 40 Octets: 0 - .. string.char(0x00):rep(40) + .. ("\x00"):rep(40) -- The following are optional if the Authenticated bit is set: -- Encryption Keyid 4 Octets: 0 -- Message Authentication Code 16 Octets (MD5): 0 diff --git a/scripts/pcanywhere-brute.nse b/scripts/pcanywhere-brute.nse index eb4788cf6..1a9af0a5f 100644 --- a/scripts/pcanywhere-brute.nse +++ b/scripts/pcanywhere-brute.nse @@ -121,14 +121,14 @@ Driver = { stdnse.debug1( "Trying %s/%s ...", user, pass ) -- send username and password -- both are prefixed with 0x06, size and are encrypted - status, err = self.socket:send(bin.pack("C",0x06) .. bin.pack("C",string.len(user)) .. encrypt(user) ) -- send username + status, err = self.socket:send("\x06" .. bin.pack("C",string.len(user)) .. encrypt(user) ) -- send username status, response = self.socket:receive_bytes(0) if not status or string.find(response,"Enter password") == nil then stdnse.debug1("Sending username failed") return false, brute.Error:new( "Sending username failed." ) end -- send password - status, err = self.socket:send(bin.pack("C",0x06) .. bin.pack("C",string.len(pass)) .. encrypt(pass) ) -- send password + status, err = self.socket:send("\x06" .. bin.pack("C",string.len(pass)) .. encrypt(pass) ) -- send password status, response = self.socket:receive_bytes(0) if not status or string.find(response,"Login unsuccessful") or string.find(response,"Invalid login.")then stdnse.debug1("Incorrect username or password") diff --git a/scripts/smb-brute.nse b/scripts/smb-brute.nse index 989e75da4..0ba5e0522 100644 --- a/scripts/smb-brute.nse +++ b/scripts/smb-brute.nse @@ -165,8 +165,8 @@ result_strings[results.INVALID_WORKSTATION] = "Valid credentials, account canno ---Constants for special passwords. These each contain a null character, which is illegal in -- actual passwords. -local USERNAME = string.char(0) .. "username" -local USERNAME_REVERSED = string.char(0) .. "username reversed" +local USERNAME = "\0username" +local USERNAME_REVERSED = "\0username reversed" local special_passwords = { USERNAME, USERNAME_REVERSED } ---Generates a random string of the requested length. This can be used to check how hosts react to diff --git a/scripts/smb-psexec.nse b/scripts/smb-psexec.nse index 4114e4f1e..aa7f73b64 100644 --- a/scripts/smb-psexec.nse +++ b/scripts/smb-psexec.nse @@ -1102,7 +1102,7 @@ local function service_file_is_xor_encoded(filename) return nil, "Can't read from service file" end -- This is the XOR-inverse of "MZ". - return bytes == string.char(0xb2, 0xa5) + return bytes == "\xb2\xa5" end ---Upload all of the uploadable files to the remote system. diff --git a/scripts/ssl-ccs-injection.nse b/scripts/ssl-ccs-injection.nse index 38f18773c..597ec289e 100644 --- a/scripts/ssl-ccs-injection.nse +++ b/scripts/ssl-ccs-injection.nse @@ -1,10 +1,8 @@ -local bin = require('bin') local match = require('match') local nmap = require('nmap') local shortport = require('shortport') local sslcert = require('sslcert') local stdnse = require('stdnse') -local string = require('string') local table = require('table') local vulns = require('vulns') local have_tls, tls = pcall(require,'tls') @@ -201,7 +199,7 @@ local function test_ccs_injection(host, port, version) -- change_cipher_spec message local ccs = tls.record_write( - "change_cipher_spec", version, bin.pack("C", 0x01)) + "change_cipher_spec", version, "\x01") -- Send the first ccs message status, err = s:send(ccs) diff --git a/scripts/sslv2.nse b/scripts/sslv2.nse index ed1dcb956..81bdff895 100644 --- a/scripts/sslv2.nse +++ b/scripts/sslv2.nse @@ -108,7 +108,7 @@ local give_n_bytes = function(idx, n, str) -- returns the next n bytes of a string if (idx + (n - 1) > #str) then - return (idx + n), string.rep(string.char(0x00), n); + return (idx + n), string.rep("\0", n); end return (idx + n), string.sub(str, idx, (idx + (n - 1)) ); @@ -214,11 +214,11 @@ action = function(host, port) -- some sanity checks: -- is response a server hello? - if (message_type ~= string.char(0x04)) then + if (message_type ~= "\x04") then return; end -- is certificate in X.509 format? - if (certificate_type ~= string.char(0x01)) then + if (certificate_type ~= "\x01") then return; end @@ -227,7 +227,7 @@ action = function(host, port) -- actually run some tests: local o = stdnse.output_table() - if (ssl_version == string.char(0x00, 0x02)) then + if (ssl_version == "\0\x02") then table.insert(o, "SSLv2 supported") o["ciphers"] = available_ciphers end diff --git a/scripts/targets-ipv6-multicast-slaac.nse b/scripts/targets-ipv6-multicast-slaac.nse index 13e7cd576..88417d297 100644 --- a/scripts/targets-ipv6-multicast-slaac.nse +++ b/scripts/targets-ipv6-multicast-slaac.nse @@ -87,7 +87,7 @@ local function build_router_advert(mac_src,prefix,prefix_len,valid_time,preferre local prefix_option_msg = string.char(prefix_len, 0xc0) .. --flags: Onlink, Auto packet.set_u32("....",0,valid_time) .. packet.set_u32("....",0,preferred_time) .. - string.char(0,0,0,0) .. --unknown + "\0\0\0\0" .. --unknown prefix local icmpv6_prefix_option = packet.Packet:set_icmpv6_option(packet.ND_OPT_PREFIX_INFORMATION,prefix_option_msg) local icmpv6_src_link_option = packet.Packet:set_icmpv6_option(packet.ND_OPT_SOURCE_LINKADDR,mac_src) diff --git a/scripts/tftp-enum.nse b/scripts/tftp-enum.nse index f2dbf64f4..819c1c023 100644 --- a/scripts/tftp-enum.nse +++ b/scripts/tftp-enum.nse @@ -1,4 +1,3 @@ -local bin = require "bin" local datafiles = require "datafiles" local math = require "math" local nmap = require "nmap" @@ -94,7 +93,7 @@ end local create_tftp_file_request = function(filename) - return bin.pack('CC', 0x00, 0x01) .. filename .. bin.pack('C', 0x00) .. 'octet' .. bin.pack('C', 0x00) + return "\0\x01" .. filename .. "\0octet\0" end local check_file_present = function(host, port, filename)