Warning command substitution ignored null byte in input

Jake

Guest

  • #1

Jake Asks: How do I ignore "command substitution: ignored null byte in input"?
I have this Linux shell command:

Code:

echo $(python3 -c 'print("Test"+"\0"+"M"*18)') | nc -u [IP] [PORT]

My intention is to pipe the output of the print statement to the netcat command. The netcat command creates a socket to some service that essentially returns an stdout of the string passed in.

The problem here is that when I try to run this command, I get this message: -bash: warning: command substitution: ignored null byte in input; and my null byte \0 gets ignored. But I don't want the null byte to be ignored.

How do I tell the system to NOT ignored my null byte and take in the input exactly as I've specified.

I have done some Google searches but honestly speaking they haven't helped much. Also, any link to some great article is much appreciated.


EDIT

Using printf worked.

Ordinarily passing python3 -c 'print("Test"+"\0"+"M"*18)' also worked. Valued @cas explanation. I guess I might be sticking to printf given it's faster (though speed isn't particularly a concern in my case).

Thanks to all those who contributed .

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, solveforum.

/forums/whats-new/news-feed

  • Noremac
  • 5 minutes ago
  • Technology Forum
  • Replies: 0

Noremac Asks: Should I avoid testing on live data for acceptance testing?
My team is transitioning into using BDD and cucumber. We are creating acceptance tests and from what I understand we want to be high level, happy path type tests that are hitting our features end to end as a user would.

How do we:

  1. Ensure the changing data on a live environment won't cause tests to have false failures?
  2. Protect changes deployed to an environment from impacting all customers if things go wrong?

Alternatively we've considered having a sterile, repeatable database that we could use for the app to run against. However, then how would we:

  1. Ensure that we don't miss features failing because the data isn't representative of live data.
  2. Avoid testing too closely to implementation rather than behavior

I would love to get some pointers on best practices here.

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • costa rica
  • 5 minutes ago
  • Technology Forum
  • Replies: 0

costa rica Asks: Gunicorn error: unrecognized arguments: run:app (using waitress and nginx)
I am using an AWS ubuntu machine to run a Flask Blueprints application. I have been able to run in development mode where my service file has an ExecStart like this: ExecStart=/home/ubuntu/environments/venv_wsh06api/bin/gunicorn -w 3 -b 0.0.0.0:8001 run:app

But now I want to run using waitress. I have tried every iteration I can think of: gunicorn waitress -w 3 -b 0.0.0.0:8080 run:app

and each is giving some version of “gunicorn: error: unrecognized arguments: run:app”. It’s always last argument where I am telling what app to run that is being called out as the error.

I have seen some very elaborate run.py files but none seem to apply to me. I know there are a few other posts and even a Medium article that closely address my needs. I’ve parsed through them in detail alternating things and still not getting anywhere.

Any advice greatly appreciated. Even a suggestion where to look would be wonderful. Thanks.

wsh06dev03.service

Code:

[Unit]
Description=Gunicorn instance to serve wsh06api3.service in venv_wsh06api.
After=network.target

[Service]
User=ubuntu
Group=www-data
WorkingDirectory=/home/ubuntu/applications/whatSticks06api
Environment="PATH=/home/ubuntu/environments/venv_wsh06api/bin"
ExecStart=/home/ubuntu/environments/venv_wsh06api/bin/gunicorn waitress -w 3 -b 0.0.0.0:8080 run:app

[Install]
WantedBy=multi-user.target

run.py

Code:

from app_package import create_app
from waitress import serve

app = create_app()

if __name__ == '__main__':
    serve(app, host='0.0.0.0', port=8080)

init.py

Code:

from flask import Flask
from wsh_config import ConfigDev, ConfigProd
import logging
from logging.handlers import RotatingFileHandler
import os

config_object = ConfigDev()

logs_dir = os.path.join(os.getcwd(), 'logs')

if not os.path.exists(logs_dir):
    os.makedirs(logs_dir)

#Setting up Logger


def create_app():
    app = Flask(__name__)
    app.config.from_object(config_object)

    from app_package.scheduler.routes import sched_route
    
    app.register_blueprint(sched_route)
    
    return app


SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • Katie Lee
  • 5 minutes ago
  • Technology Forum
  • Replies: 0

Katie Lee Asks: Want to find a PCRE -P that finds expressions that do not contain a certain string of letters
I have been trying to find a way to make an expression that looks through a word and if "abc" is in it it does not match

I have grep -P '^([^a](a([^b]|$)|ab([^c]|$))?)$'

It passes all test cases except the following

qwerababcqwer

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • jack parsons
  • 5 minutes ago
  • Technology Forum
  • Replies: 0

jack parsons Asks: I am starting a new rails app(Rails 7.0.4) with the option --webpack=react and I have no /app/javascript/packs folder
I have installed node and npm I tried brew install yarn but that may have failed.... I am copying a tutorial by Zayne on how to get ruby on rails running with react and he used the command rails new react-app --webpack=react and he got a folder called /app/javascript/packs with a file called hello_react.jsx, maybe this is because he is on RoR 6 and I am using version Rails 7.0.4.

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • user3751743
  • 5 minutes ago
  • Technology Forum
  • Replies: 0

user3751743 Asks: WebCenter Site - Exception Caught While Trying To Locate Configuration For IndexSource + Global
I have this message in WebCenter Site. (I use 11.1.1 version)

NullPointerException thrown when trying to configure Global Search through Advanced UI. [2012-08-21 09:17:55,137] [com.fatwire.search.asset] Exception caught while trying to locate Configuration for IndexSource + Global. Error details is com.fatwire.cs.core.search.source.IndexSourceException: java.util.NoSuchElementException [2012-08-21 09:17:55,138] [com.fatwire.search.asset] Error during indexing operation java.lang.NullPointerException at com.fatwire.search.source.GlobalAssetIndexSourceMetadataImpl.getSearchEngineName(y:2233) at com.fatwire.search.util.AssetQueueIndexSourceUtil._processAll(y:2504) at com.fatwire.search.util.AssetQueueIndexSourceUtil.access$000(y:2373) at com.fatwire.search.util.AssetQueueIndexSourceUtil$indexingRunnable.run(y:3252) at java.lang.Thread.run(Thread.java:662)

How can I repair this issues Could you help me please?

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.