S
S
Sergey Grigorov2015-08-26 12:56:08
JavaScript
Sergey Grigorov, 2015-08-26 12:56:08

NMAP on the site - how?

Hello. I came across one project ( tyts ).
It became interesting - how they implemented NMAP on their website.
Rummaged Google for API or documentation on the topic Online NMAP, everywhere is empty.
Does anyone know how they managed to do it?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
U
Urukhayy, 2019-03-05
@Urukhayy

class Pizza {
    constructor() {
        this.crust = prompt('Choose your crust: ');
        this.array = new Array(+prompt('How many toppings do you want?')).fill(0);
    }

    makeTopping() {
        this.array = this.array.map(function (t) { return prompt('Choose your topping: ') })
    }

    makePizza() {
        return `Your order is done! You choose ${this.crust} crust with these toppings: ${this.array.join(', ')}`
    }
}

let personalPizza = new Pizza();
personalPizza.makeTopping();
alert(personalPizza.makePizza());

D
Dmitry Belyaev, 2019-03-05
@bingo347

class Pizza {
    constructor() {
        this.crust = prompt('Choose your crust: ');
        this.toppingsCount = +prompt('How many toppings do you want?') || 0;
        this.toppings = [];
    }

    makeToppings() {
        const {toppings, toppingsCount} = this;
        for(let i = toppingsCount; i--;) {
            toppings.push(prompt('Choose your topping: '));
        }
    }

    makePizza() {
        const {crust, toppings} = this;
        return `Your order is done! You choose ${crust} crust with these toppings: ${toppings.length ? toppings.join(', ') : 'nothing'}`;
    }
}

let personalPizza = new Pizza();
personalPizza.makeTopping();
console.log(personalPizza.makePizza());

R
Robur, 2019-03-05
@Robur

do not use prompt (if this is a real project for real people)
do not use '+' for conversion (if there is no purpose to show off knowledge of clumsy JS)
remove user interaction in the constructor and make a separate method. (if this is a real project for real people)
replace this.toppingswith const toppings
give a arraymeaningful name.
Removing the class altogether (optional, if this code is used in this form)
console.login the last line is meaningless. Either return a value from a function, or call it just like that.
The rest is taste.

A
Alexander Kositsyn, 2019-03-05
@alex_keysi

No. He is perfect))

S
Sergey delphinpro, 2019-03-06
@delphinpro

parameters are not used, I forgot to remove them from the constructor)

but in vain. The original path was correct.
Pizza can't ask the customer how to cook it by itself =))
Someone else will get the data from the user and pass it to the Pizza object
const crust = prompt('Choose your crust: ');
const howMany = +prompt('How many toppings do you want?');
const personalPizza = new Pizza(crust, howMany);

This is perhaps the main mistake in the code - architectural. Everything else that was written about is stylistic trifles.

V
Vinni37, 2015-09-03
@Vinni37

If in php then try shell_exec.
Here is some discussion

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question