Palestinians gather around the remains of a charitable-organization building, which witnesses said was hit by an Israeli airstrike, in Khan Younis in the southern Gaza Strip on Monday. (Ibraheem Abu Mustafa/Reuters)

After 49 days of war, the armies of Israel and Hamas appear to have run out of new ideas — but not bombs. They are now slugging it out in a lopsided war of attrition.

As rumors fly that another cease-fire could be imminent, Hamas and Israel are groping for a diplomatic solution that could allow both to declare victory — or in the case of Hamas, at least avoid an obvious loss.

But without a permanent truce, the war of attrition could drag on for weeks or longer. Defense Minister Moshe Yaalon said Sunday, “If the leaders of Hamas think they can wear us down, they are wrong.”

As the conflict enters its eighth week, the populations on both sides are less angry than exhausted.

In Israel, smartphone apps ping warnings of incoming rockets with the dull monotony of traffic updates.

In Gaza, more than a quarter of the population has been at least temporarily displaced.

They are not alone. In Israel, communities along the border with Gaza now resemble ghost towns, as families with children have fled.

In briefings with foreign journalists and visiting U.S. delegations, Israeli commanders have always stressed that whenever Israel goes to war, it wants to achieve quick, decisive victories, measured not in months or weeks but in days.

The 2006 Lebanon war between Israel and Hezbollah lasted 33 days. The last two wars in Gaza against Hamas, in 2009 and 2012, went 22 days and eight days, respectively.

This time, Prime Minister Benjamin Netanyahu is warning that a war that began July 8 might continue into September, when Israeli schoolchildren are scheduled to return to classes — a potential setback for Netanyahu and Israeli military leaders, who have made a return to “peace and quiet” their metric for success.

Hamas’s supply of rockets

Hamas began the current conflict with about 10,000 rockets, most of them short-range projectiles that have done relatively little physical damage and caused four civilian deaths.

A senior Israeli military spokesman, Lt. Col. Peter Lerner, said Hamas has launched about 4,000 rockets. He estimated that Israeli strikes have destroyed an additional 3,500, leaving 2,500 rockets in the Hamas armory.

At its current burn rate of firing 100 rockets a day, Hamas can continue for another month.

The Israeli air force, resupplied by its partner the United States, can continue to strike targets and Hamas commanders in Gaza almost indefinitely.

Over the weekend, Israel leveled a 12-story building in central Gaza City. Before that, Israeli airstrikes killed three senior Hamas commanders. On Monday, Israel pounded two mosques that it said were used as storehouses for weapons or as meeting points for militants.

For its part, Hamas has sworn that it will never surrender or give up its arms. In a raw display of power — or panic — the group publicly executed 24 alleged collaborators over the past five days.

Hamas may be running out of rockets, but not mortars — or martyrs.

U.N. agencies in Gaza report that 2,042 people have been killed, most of them civilians. UNICEF says its verification teams have counted 491 children killed in the war, including 327 who were 12 years old or younger.

Hamas and the other militias in Gaza fired repeated salvos of short-range rockets into Israel on Monday. Israeli news outlets and their live blogs featured an seemingly endless scroll.

From the daily newspaper Haaretz on Monday:

“6:08 P.M. Major barrage fired at Gaza border communities. At least a dozen alerts sound in a matter of minutes.

“5:54 P.M. One rocket intercepted over Ashdod, one rocket lands in an open area.

“5:46 P.M. Rocket sirens sound in Sderot and Gaza border communities.”

The Israel Defense Forces tweeted that Hamas is launching, on average, a rocket every 10 minutes, equal to the rate in the first week of hostilities in early July.

Families flee mortars

After the death of 4-year-old Daniel Tragerman, killed at Kibbutz Nahal Oz by shrapnel from a Hamas mortar round Friday, families near the Gaza border in southern Israel are fleeing their homes in a near-panic.

The unknown numbers of mortars in the Hamas arsenal are easily deployed by two-man teams using a simple metal tube; the men can pop up anywhere, fire their round and disappear. The weapons have a range of about a mile.

“Mortar fire can be devastating,” Lerner said.

He said that Israeli bombardment has destroyed rocket-manufacturing facilities across Gaza but that Hamas can probably continue to assemble projectiles, since all it takes is “a set of diagrams, some materials and a space the size of your bedroom.”

“They have thousands of mortars,” said Kobi Michael, a former head of the Palestinian desk at Israel’s Ministry of Strategic Affairs. “They can launch mortars, in very limited quantities each day, and they can disrupt daily life for a very long time.”

Michael said Hamas assumes that Israel will not undertake another ground offensive, so the group believes it can soldier on.

“I cannot see Israel continuing with this strategy of attrition for a long time,” Michael said. “It cannot be tolerated for long.”

Israel hopes that it will grind Hamas down and bring it back to the truce talks in a weak position, so that Israel and its quiet ally, the military-led government of Egypt, can dictate terms.

Israeli military officials say Hamas has been hit, and hit hard. Israeli forces discovered and destroyed 32 offensive tunnels in the buffer zone along the Gaza border, 14 of which crossed into Israel.

Over the weekend, Netanyahu warned the civilians of Gaza “to vacate immediately every site from which Hamas is carrying out terrorist activity. Every one of these places is a target for us.”

But despite calls from the Israeli right wing to strike a decisive blow against Hamas, neither Netanyahu nor the Israeli majority appears to have the stomach for a massive ground invasion and the reoccupation of the Gaza Strip, which is what it would take for Israel to bring the Islamist resistance movement to its knees.

“The dilemma is that the two sides cannot afford the continuity of the current confrontation, but at the same time the two sides cannot accept the demands of the other side” for a permanent truce, said Ghassan Al Khatib, a lecturer at Birzeit University in Ramallah.

“I don’t know for sure how long they can continue, but it seems they have a way to go,” he said.

Khatib said there are no public signs in Gaza that the people are putting pressure on Hamas to stop. Nor has the military or political wing of Hamas been hurt in any existential way — so it is possible that Hamas’s campaign will go on and on.