python-nmap 相当于 nmap shell 命令

问题描述

我有以下 nmap shell 命令:

/* This example requires Tailwind CSS v2.0+ */
import { Fragment,useState } from "react";
import { Dialog,Transition } from "@headlessui/react";
import FormAlert from "./FormAlert.js";
import { LockClosedIcon } from "@heroicons/react/solid";
import { XCircleIcon } from '@heroicons/react/solid'

import { useForm } from "react-hook-form";
// import { useRouter } from "next/router";

// import AuthForm from "./AuthForm.js"

export default function AuthModal() {
  const [open,setopen] = useState(false);

  const [pending,setPending] = useState(false);
  // const { handleSubmit,register,errors,getValues } = useForm();
  const [user,setUser] = useState({ name: "Sign Up!" });
  const [formAlert,setFormAlert] = useState(null);

  console.log(user);

  // Handle form submission
  const submit = (e) => {
    setPending(true);
    console.log({ name: user.name,email: user.email });
    const payload = JSON.stringify({
      email: user["email"],name: user["name"],});

    console.log(payload);

    e.preventDefault();
    fetch("https://xxx/fakeAuth",{
      method: "POST",mode: "no-cors",headers: { "Content-Type": "application/json" },body: payload,})
      .then((res) => res.json())
      .then((json) => setUser(json))
      .catch((error) => {
        // Show error alert message
        console.log(error);
        setFormAlert({ type: "error",message: "didn't work!" });
      })
      .finally(() => {
        // Hide pending indicator
        setPending(false);
      });
  };
  // setUser(name="")

  return (
    <>
      <button
        className="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded"
        onClick={() => setopen(true)}
      >
        Signup
      </button>
      {open ? (
        <Transition.Root show={open} as={Fragment}>
          <Dialog
            as="div"
            static
            className="fixed z-10 inset-0 overflow-y-auto"
            open={open}
            onClose={setopen}
          >
            <div className="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
              <Transition.Child
                as={Fragment}
                enter="ease-out duration-300"
                enterFrom="opacity-0"
                enterTo="opacity-100"
                leave="ease-in duration-200"
                leaveFrom="opacity-100"
                leaveto="opacity-0"
              >
                <Dialog.Overlay className="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" />
              </Transition.Child>

              {/* This element is to trick the browser into centering the modal contents. */}
              <span
                className="hidden sm:inline-block sm:align-middle sm:h-screen"
                aria-hidden="true"
              >
                &#8203;
              </span>
              <Transition.Child
                as={Fragment}
                enter="ease-out duration-300"
                enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
                enterTo="opacity-100 translate-y-0 sm:scale-100"
                leave="ease-in duration-200"
                leaveFrom="opacity-100 translate-y-0 sm:scale-100"
                leaveto="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
              >
                <div className="inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-sm sm:w-full sm:p-6">
                  <>
                  {formAlert ? (
                    <FormAlert  type={formAlert.type} message={formAlert.message} />
         
        ) : (
                    <div className=" flex items-center justify-center bg-gray-50 py-12 px-4 sm:px-6 lg:px-8">
                      <div className="max-w-md w-full space-y-8">
                        <div>
                          <img
                            className="mx-auto h-12 w-auto"
                            src="/static/example_photos/fullheaderlogo.png"
                            alt="Workflow"
                          />
                          <h2 className="mt-6 text-center text-3xl font-extrabold text-gray-900">
                            Create your account
                          </h2>
                        </div>

                        <form
                          className="mt-8 space-y-6"
                          onSubmit={submit}
                          method="POST"
                        >
                          <input
                            type="hidden"
                            name="remember"
                            defaultValue="true"
                          />
                          <div className="rounded-md shadow-sm -space-y-px">
                            <div>
                              <label htmlFor="Name" className="sr-only">
                                Name
                              </label>
                              <input
                                type="text"
                                name="user[name]"
                                id="name"
                                value={user.name}
                                onChange={(e) =>
                                  setUser({ ...user,name: e.target.value })
                                }
                                autoComplete="Name"
                                required
                                className="appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-b-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm"
                                placeholder="Name"
                              />
                            </div>
                            <div>
                              <label
                                htmlFor="email-address"
                                className="sr-only"
                              >
                                Email address
                              </label>
                              <input
                                id="email"
                                name="user[email]"
                                value={user.email}
                                onChange={(e) =>
                                  setUser({ ...user,email: e.target.value })
                                }
                                autoComplete="email"
                                required
                                className="appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-t-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm"
                                placeholder="Email address"
                              />
                            </div>
                            <div>
                              <label
                                htmlFor="confirm-email"
                                className="sr-only"
                              >
                                Confirm Email address
                              </label>
                              <input
                                id="confirm-email"
                                name="confirmEmail"
                                type="confirmEmail"
                                autoComplete="confirmEmail"
                                required
                                className="appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-t-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm"
                                placeholder="Confirm Email Address"
                              />
                            </div>
                          </div>

                          <div>
                            <button
                              type="submit"
                              className="group relative w-full flex justify-center py-2 px-4 border border-transparent text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
                              disabled={pending}
                              onClick={submit}
                            >
                              {!pending && (
                                <div>
                                  {" "}
                                  <span className="absolute left-0 inset-y-0 flex items-center pl-3">
                                    <LockClosedIcon
                                      className="h-5 w-5 text-indigo-500 group-hover:text-indigo-400"
                                      aria-hidden="true"
                                    />
                                  </span>
                                  Sign Up
                                </div>
                              )}

                              {pending && (
                                <>
                                  <svg
                                    className="animate-spin -ml-1 mr-3 h-5 w-5 text-white"
                                    xmlns="http://www.w3.org/2000/svg"
                                    fill="none"
                                    viewBox="0 0 24 24"
                                  >
                                    <circle
                                      className="opacity-25"
                                      cx="12"
                                      cy="12"
                                      r="10"
                                      stroke="currentColor"
                                      strokeWidth="4"
                                    ></circle>
                                    <path
                                      className="opacity-75"
                                      fill="currentColor"
                                      d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
                                    ></path>
                                  </svg>
                                  <span>Please wait...</span>
                                
                                </>
                              )}
                            </button>
                          </div>
                        </form>
                      </div>
                    </div>
         )} </>{" "}
                </div>
              </Transition.Child>
            </div>
          </Dialog>
        </Transition.Root>
      ) : null}
    </>
  );
}

如果我使用像 python-nmap 这样的 Python 库,我可以运行上面的命令吗?

如果是,那么使用 python-nmap 执行此操作的正确方法是什么?

注意:在上面的命令中,nmap -sV -AR -T5 --script rtsp-url-brute ip_address -oX nmap_output.xml 一个 nse 脚本。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)