Saravanan666/pypi-org huggingface dataset:
Package: secure-aiohttp
secure-aiohttpLibrary implements CSP and HSTS headers. In future CSRF token and maybe some other default security handlers will be added.HSTS(Strict-Transport-Security)Way for web site to tell browsers that it should only be accessed using HTTPS, instead of using HTTP. Which is usually used for connection, even if web site enables HTTPS.
Helps to avoid man in the middle attack.(source)
You can learn more here:https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-SecurityAvaliable parameters:ParameterDefenitionDefaulthstsshould HSTS header be addedTruehsts_max_agefor how long in seconds browser should redirect directly to HTTPS31536000(one year)hsts_inclue_subdomainsshould include subdomainsTruehsts_preloadshould use preloadTrueCSP(Content-Security-Policy)Content Security Policy (CSP) is an added layer of security that helps to detect and mitigate certain types of attacks, including Cross Site Scripting (XSS) and data injection attacks. These attacks are used for everything from data theft to site defacement to distribution of malware.(source)
Basically it block all sources for front-end libraries/images/objects... that are not specified in whitelist to avoid downloading malicious code that can gather sensetive user data.
You can learn more here:https://developer.mozilla.org/en-US/docs/Web/HTTP/CSPhttps://content-security-policy.com/Avaliable parameters:ParameterDefenitionDefaultcspShould CSP header be added and if yes - what it should includeNonecsp_testingEnable CSP in report only mode, without actually blocking sourcesFalsescp_report_uriWhere browser should send CSP reports/secureaiohttp-csp-report-uricspparameter can be either:Noneto avoid using  CSP header at alldefault|same-origin|google-analitycsto use predifined CSP headerdictwith custom CSP parameters, example:'myCSP': {
    'connect-src': 'self',
    'default-src': 'none',
    'img-src': 'self',
    'script-src': 'self',
    'style-src': 'self',
    'report-uri': '/my-csp-report-handler',
    'block-all-mixed-content': None
}You need to passNonefor parameters that require no values, likeblock-all-mixed-content.Predifined CPS header variants are taken fromhttps://content-security-policy.com/and include:default: This policy allows images, scripts, AJAX, and CSS from the same origin, and does not allow any other resources to load (eg object, frame, media, etc). It is a good starting point for many sites.google-analitycs: Allow Google Analytics, Google AJAX CDN and Same Origin.same-origin: Only Allow Scripts from the same origin.ExamplesYou can see some simple examples inexamplefolder.ContributionAny contributions are welcome! Take action in securing your users! ;)Licensesecure-aiohttpis offered under the Apache 2 license.
Package: secureaws
secure-awsThis package will scan your AWS account to identify whether basic security services are enabled. If not, will help you enable/setup the same.Covered Services:CloudTrailConfigRoot MFAVPC Flow LogsStrong Password PolicyMacieGuardy DutyS3 SSE EncryptionEBS EncryptionMore coming soon...Installation (Any 1):Runpip3 install secureawsClone the repo and runpython3 setup.py installHelp:secureaws --helpsecureaws <command> --helpExamples:Scan AWS account using AWS keys:secureaws check --access-key XXXXXX --secret-key XXXXXX --region us-west-2Scan AWS account using profile:secureaws check --profile xxx --region eu-west-1Setup all services in interactive mode:secureaws setup --profile XXXXXX --region ap-south-1Setup all services in non-interactive mode (except ebs-sse):secureaws setup --access-key XXXXXX --secret-key XXXXXX -ySetup specific service(s):secureaws setup --profile XXXXXX --region ap-south-1 -s config -s mfaGenerate RSA Key Pair:secureaws genrsaGenerate RSA Key Pair with custom filename and key size:secureaws genrsa --file-name xxx --key-size 2048
Package: secure-bucket-construct
Secure Bucket ConstrucsBlog:https://yvovanzee.nl/secure-s3-bucket-construct-with-cdk-version-2This Secure Bucket construcs extends the S3 Bucket construct. When using this construct, you will create a S3 bucket with default security best practises enabled. These are:Block public accessEnabled versioningEnable enforce SSL to connect to bucketEnabled Bucket access loggingEncryption of the bucket with a customer managed KMS key with enabled key rotation and trusted account identities.These best practises are enforced. When creating a SecureBucket with for example versioning disabled, it will be overwritten to enabled.Usageinstall packagenpminstall@enterprise_secure_bucketImport the secure bucket construct in your code.//Importnecessarypackagesimport{Stack,StackProps}from'aws-cdk-lib';import{Construct}from'constructs';import{SecureBucket}from'enterprise-secure-bucket';exportclassSecureBucketStackextendsStack{constructor(scope:Construct,id:string,props?:StackProps){super(scope,id,props);newSecureBucket(this,'myEnterpriseLevelSecureBucket',{});}}
Package: secure-config-manager
secure-config-managerDescriptionSecure ConfigManager offers splitting your JSON config files into two parts.We suggest one mainconfig.jsonfile that can be safely checked out to version control system. This can contain default values or a sample config structure for reference. The second one would beconfig_override.json, containing secret tokens or environment-dependent values.Data inconfig_override.jsonis assumed to be more relevant, hence if the value is present in both configs, we choose config_override.Usage example>>> from secure_config_manager import ConfigManager
>>> config_manager = ConfigManager(config_path="tests/test_config.json", config_override_path="tests/test_config_override.json", redacted_keys=("secret", "key"))
>>> config_manager.load_config_with_override()
{'key_a': {'attr1': 'value1', 'attr2': 'new_value', 'attr_secret': 'secret_value'}, 'key_b': {'attr1': 1}, 'key_c': {'app_key': 'sensitive_value'}}
>>> config_manager.redact(config_manager.get_key_a_config())
{'attr1': 'value1', 'attr2': 'new_value', 'attr_secret': '*****'}Notes:ConfigManager is a singleton classConfigManager is application-agnostic and can be used in any Python 3.x project of your choice
Package: secure-context
Secure ContextUtilities for creation of SSL/TLS security contexts for servers and clientsThe purpose of this module is to expose, simple to use, secure definitions that follow current, community agreed,
standards. As of now it offers methods for creation of client and server secure contexts.It isSTRONGLY RECOMMENDEDthat youREADtheCODE BEFOREconsideringUSINGthis library.
I amNOT RESPONSIBLEif your product is hacked or cats become humans overlords due to usage of this code.DocumentationCurrently, only two functions are exported:defcreate_server_ssl_context(cert_file:Union[Path,str],key_file:Union[Path,str],*,ca_file:Optional[Union[Path,str]]=None,ca_path:Optional[Union[Path,str]]=None,ca_data:Optional[Union[bytes,str]]=None,crl_file:Optional[Union[Path,str]]=None,protocols:Optional[List[str]]=None,ca_load_default:bool=False,)->ssl.SSLContext:"""Create SSL context for TLS serversArgs:cert_file: Path to SSL certificate filekey_file: Path to private key fileca_file: Path to a file of concatenated CA certificates in PEM formatca_path: Path to a directory containing CA certificates in PEM format, following an OpenSSL specific layoutca_data: ASCII string of one or more PEM-encoded certificates or a bytes-like object of DER-encoded certificatescrl_file: Path to a certificate revocation list fileprotocols: ALPN and NPN protocols acceptedca_load_default: Whether to load system defaults (default: {False})Note:If any of `ca_file`, `ca_path`, `ca_data` are defined client authentication will be enabled, which requires allclients to provide a accepted certificate to connect to the server.Raises:SSLError: Occurs if SSLContext creation failsFileNotFoundError: Occurs if a file path is invalidReturns:SSL context"""...defcreate_client_authentication_ssl_context(cert_file:Union[Path,str],key_file:Union[Path,str],*,ca_file:Optional[Union[Path,str]]=None,ca_path:Optional[Union[Path,str]]=None,ca_data:Optional[Union[bytes,str]]=None,crl_file:Optional[Union[Path,str]]=None,protocols:Optional[List[str]]=None,check_hostname:bool=True,)->ssl.SSLContext:"""Create SSL context for clients that require TLS client authenticationWARNING:For clients that DO NOT require client authentication,ssl.create_default_context should be used insteadArgs:cert_file: Path to SSL certificate filekey_file: Path to private key fileca_file: Path to a file of concatenated CA certificates in PEM formatca_path: Path to a directory containing CA certificates in PEM format, following an OpenSSL specific layoutca_data: ASCII string of one or more PEM-encoded certificates or a bytes-like object of DER-encoded certificatescrl_file: Path to a certificate revocation list fileprotocols: ALPN and NPN protocols acceptedcheck_hostname: Server hostname match (default: {False})Raises:SSLError: Occurs if SSLContext creation failsFileNotFoundError: Occurs if a file path is invalidReturns:SSL context"""...LicenseCopyright © 2019-2021 Vítor VasconcellosBSD-3-Clause
Package: secure-cookie
Provides interfaces for secure cookies and sessions in WSGI
applications. Secure cookies are cryptographically signed (but not
encrypted) to prevent tampering. Sessions are data associated with a
given user across requests and responses.InstallInstall in avirtualenvwithpip:$ pip install secure-cookieLinksDocumentation:https://secure-cookie.readthedocs.io/Releases:https://pypi.org/project/secure-cookie/Code:https://github.com/pallets/secure-cookieIssue tracker:https://github.com/pallets/secure-cookie/issuesOfficial chat:https://discord.gg/t6rrQZH
Package: secured-console-chat
Welcome to command line chat project [CMD CHAT]What is this?It is a console chat with message encryption.How does it work?All you need to do is run a web server and connect to it via a client.RunCreate and activate a virtual environment in Pythonpip install secured_console_chatimport asyncio 
import cmd_chat

if __name__ == '__main__':
    asyncio.run(cmd_chat.run())OrStart server:cmd_chat serve localhost 5000Connect to server:cmd_chat connect localhost 5000 tylerHow does encryption work?The client generates a private key.The server generates a symmetric key.The client sends the public key to the server.The server encrypts the symmetric key and sends it to the client.The client encrypts the private key.After that, communication with the server occurs via the symmetric key.ExampleKnown bugsSometime WS just drop connectionClient input message problem. To start input, you need to press enter first, only after that you got pop up with message. Tried to fix, but nothing worked.
Package: secure-delete
secure_deletesecure_delete is a tool for safely delete files.Files deleted with secure_delete will be difficult to recover.Environment requirementsPython 3.XSupport for Windows and LinuxInstallpipinstallsecure_deleteUsageCommandsecdel--helpPython libfromsecure_deleteimportsecure_deletesecure_delete.secure_random_seed_init()secure_delete.secure_delete('Z:\\TEST.exe')LicenseMIT License
Package: securedrop-log
securedrop-logThis is a Python module and qrexec service for logging in Qubes forSecureDrop.How to use/try this?In our example, we will use a vm namedloggingfor storing logs, and we will useworkvmto send in logs to theloggingvm.In dom0Create a file/etc/qubes-rpc/policy/securedrop.Logindom0with the following content.workvm logging allow
@anyvm @anyvm denyIn logging vmAdd the following content to/etc/qubes-rpc/securedrop.Log/usr/sbin/securedrop-logand then placesecuredrop-logscript to/usr/sbin/directory and make sure that
it is executable.To use from any Python code in workvmHere is an example code using Python loggingimportloggingfromsecuredrop_logimportSecureDropLogdefmain():handler=SecureDropLog("workvm","proxy-debian")logging.basicConfig(level=logging.DEBUG,handlers=[handler])logger=logging.getLogger("example")logger.info("kushal says it works")if__name__=="__main__":main()The journalctl exampleYou will needpython3-systemdpackage for the same.The code is injournal-example.pyfile.
Package: secure-ec2
CLI tool that helps you to provision EC2 instances securelyFree software: MIT licenseDocumentation:https://secure-ec2.readthedocs.io.TL;DR$brewtapavishayil/homebrew-taps&&brewinstallsecure-ec2# Install secure_ec2 via homebrew§secure_ec2config# Generating secure launch configuration§secure_ec2launch# Launching instance(s) according to the generated launch configurationUsage & InstallationInstall via Homebrew§brewtapavishayil/homebrew-taps§brewinstallsecure-ec2Install via pip§pipinstallsecure_ec2Usage§secure_ec2Usage:secure_ec2[OPTIONS]COMMAND[ARGS]...CLItoolthathelpsyoutoprovisionEC2instancessecurelyOptions:--helpShowthismessageandexit.Commands:configlaunchConfiguration§secure_ec2config?WhattypeofOS?1)Windows2)LinuxAnswer:1The first thing thatsecure_ec2does is to create a persistent launch configuration per operating system. The current operating systems supported are Windows and Linux, and updates to the launch configuration are being made per operating system.secure_ec2will later on look for the launch template to launch your instances, but you can also use these templates to launch instances yourself later on.
In the configuration phase, the following steps are done behind the scenes:Look for the default VPC and public subnet on the selected operating region.Provision a security group, with open ingress to the computer public IP according to the selected operating system port for future use.Provision a launch template that utilize the VPC, subnet and security group settingsInstance ProvisioningExample for launching a Linux instance with Keypair:§secure_ec2launch?WhattypeofOS?Linux?Howmanyinstances?1?Keypairdemo-kp?InstanceTypet2.microExample for launching a Windows instance with Session Manager access:§secure_ec2launch?WhattypeofOS?Windows?Howmanyinstances?1?KeypairNone?InstanceTypet2.microCommand Line Usage:§secure_ec2config-tLinux# Generate launch template for Linux instances§secure_ec2config-tWindows# Generate launch template for Windows instances§secure_ec2launch-tLinux-n3-kNone-it2.micro# Provision 3 Linux instance with Session Manager access§secure_ec2launch-tWindows-n1-kdemo-kp-it2.micro# Provision a Windows instance with KeypairCLI Configuration Parameters:Configuration ParameterTypeRequiredDescription-t –os_typestrTrueOperating system (Linux / Windows)-n –num_instancesintTrueNumber of instances to provision securely-k –keypairstrTrueKeypair name to launch the instance with-i –instance_typestrTrueInstance type, affects compute & networking performance-nc –no_clipboolFalseInstruct the tool to not copy the SSM url to the clipboard-p –profilestrFalseAWS profile name to use-r –regionstrFalseAWS region to useFeaturesProvision EC2 instance with keypair securelyProvision EC2 instance without keypair (Session Manager access) securelyDemoLinuxThe following example runs a Linux instance with SSH access using keypair:WindowsThe following example runs a Windows instance with Session Manager access:CreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.
Package: securefile-handler
Secure File HandlerThis module provides secure removing files and folders with content.Module was created as school project for MI-PYT class at FIT CTU.Task descriptionSee filehttps://github.com/dvorakj31/securefile_handler/blob/master/TASK.rstDocumentationhttps://securefile-handler.readthedocs.io/en/latest/index.htmlInstallationThis module works on Python 3.6+.Unix-like system usersEnsure you have installed c compiler on your deviceEnsure you have installed python version >= 3.6You can install this module manually via github:Click on clone or download on this page and download ZIPDowload this repository on your driveUnzip downloaded fileRun command-line and change directory to unzipped directoryRunpython setup.py installAnother way is installing this module via pip.Run command-lineRun commandpython-mpip installsecurefile-handlerWindows system usersEnsure you have correctly set and installed C Windows Compiler (you can followhttps://wiki.python.org/moin/WindowsCompilers)Ensure you have installed python version >= 3.6You can install this module manually via github:Click on clone or download on this page and download ZIPDowload this repository on your driveUnzip downloaded fileRun command-line and change directory to unzipped directoryRunpy-3setup.py installAnother way is installing this module via pip.Run command-lineRun commandpy-3-mpip installsecurefile-handler
Package: secure-fountain
Secue fountain architecturePrototype implementation of the encoding and decoding framework for the secure fountain architecture (for python 3.8+)IntroductionThe secure fountain architecture offers a quantum-resistant off-chain approach for reducing node storage requirements (with a tradeoff of increased bandwidth), without compromising blockchain verifiability.This prototype library is blockchain-agnostic. Since the secure fountain architecture is simply an opt-in decentralized peer-to-peer storage layer,  it can be run alongside the existing message distribution and storage system (with no changes to the underlying consensus protocol).(Note that quantum resistance relies using a quantum-secure hash function, of which there are many)ReferencesOur description of the secure fountain architecture can be found here:Techniques for efficient post-quantum finance (Part 4: reducing storage requirements)This implementation is inspired by:Kadhe, Swanand, Jichan Chung, and Kannan Ramchandran. "SeF: A secure fountain architecture for slashing storage costs in blockchains." arXiv preprint arXiv:1906.12140 (2019).Luby, Michael. "LT codes." The 43rd Annual IEEE Symposium on Foundations of Computer Science, 2002. Proceedings. IEEE Computer Society, 2002.ContributorsBrandon Goodell (lead author), Mitchell "Isthmus" Krawiec-ThayerBuilt byGeometry Labswith funding fromThe QRL Foundation.TestsTo install requirements for tests:pip install -r test_requirements.txtThen run:tests/test_main.pyLicenseThis library is released as free and open-source software under the MIT License, see LICENSE file for details.
Package: securehash
Secure-hashingA library used for secure password storage. Feel free to look around the source code, there is not a lot. This library also supports peppers, if you don't know what that is i suggest you look at this:https://en.wikipedia.org/wiki/Pepper_(cryptography)Word of safety: always practice cryptography with great care.RequirementsbcrypthmacUsageimportsecure_hashasshsh.hash_high(plaintext)Documentationget_salt(hash)Returns the salt used in the hash.hash_high(password,pepper="",rounds=None)Returns a hashed password. Rounds parameter is used to specify how many rounds should be used in salt generation.verify_high(password,hash0,pepper="")Returns True if the password matches the hash.hash_low(password,salt,pepper="")Returns a hashed password.verify_low(password,hash0,salt,pepper="")Returns True if the password matches the hash.InstallationUse the package managerpipto install Secure-hashing.pipinstallsecurehashing
Package: secureid
Generate unique IDInstall and importFor install secure_id :pipinstallsecureidFor import secure_id :importsecure_idFor rapidity, you can also do that :importsecure_idassidFunctionsThis module contain two functions :sid1() :>>>importsecure_id>>>print(secure_id.sid1())5356-fFTQJBMI-J-PpIB-pSqE-f2id-Hn56QO4ktKMOh8w6YVGayHQx-1sid2() :>>>importsecure_id>>>print(secure_id.sid2())698924-pePMVCUgkQEu-k-AZjO-TbT9-tKTW-aZ9iE4gsdk8CXuTn2tKanzhA-2The last number indicate which function you have used for generate the ID
Package: secure-json
DescriptionSecure settings in json fileinstallpip install secure-jsonimportfromsecure_jsonimportSettingsDescriptionThe library allows you to encrypt your settings stored in json format.
It is possible to convert from a simple storage option to an encrypted one. 
To work with the encrypted version of the settings, you need to pass the startup parameter - the password with which the encryption took place.
Try it, the library is very simple.UsageImport libsettings=Settings('Settings.json').datapath_to_repo=settings.repo.pathuser=settings.repo.userpass=settings.repo.passwordbase_name=settings.base_nameEncoding\Decodingencoding settings:python main.py <password> encodedecoding settings:python main.py <password> decodehelp:python main.py help
Package: secure-kademlia
Python Distributed Hash TableDocumentation can be found atkademlia.readthedocs.org.This library is an asynchronous Python implementation of theKademlia distributed hash table.  It uses theasyncio libraryin Python 3 to provide asynchronous communication.  The nodes communicate usingRPC over UDPto communiate, meaning that it is capable of working behind aNAT.This library is a fork of the kademlia Python library. It is intended to be roughly equivalent, but due to this library having security fixes, it is not compatible with the original nor other reference kademlia implementations. Specifically the use of sha1 and pickle have been replaced by better choicesInstallationpip install secure-kademliaUsageThis assumes you have a working familiarity withasyncio.Assuming you want to connect to an existing network:importasynciofromkademlia.networkimportServerasyncdefrun():# Create a node and start listening on port 5678node=Server()awaitnode.listen(5678)# Bootstrap the node by connecting to other known nodes, in this case# replace 123.123.123.123 with the IP of another node and optionally# give as many ip/port combos as you can for other nodes.awaitnode.bootstrap([("123.123.123.123",5678)])# set a value for the key "my-key" on the networkawaitnode.set("my-key","my awesome value")# get the value associated with "my-key" from the networkresult=awaitnode.get("my-key")print(result)asyncio.run(run())Initializing a NetworkIf you're starting a new network from scratch, just omit thenode.bootstrapcall in the example above.  Then, bootstrap other nodes by connecting to the first node you started.See the examples folder for a first node example that other nodes can bootstrap connect to and some code that gets and sets a key/value.LoggingThis library uses the standardPython logging library.  To see debut output printed to STDOUT, for instance, use:importlogginglog=logging.getLogger('kademlia')log.setLevel(logging.DEBUG)log.addHandler(logging.StreamHandler())Running TestsTo run tests:pip install -r dev-requirements.txt
pytestReporting IssuesPlease report all issueson github.Fidelity to Original PaperThe current implementation should be an accurate implementation of all aspects of the paper save one - in Section 2.3 there is the requirement that the original publisher of a key/value republish it every 24 hours.  This library does not do this (though you can easily do this manually).